aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-09-15 11:39:04 +0200
committerMartin Ridgers <[email protected]>2021-09-15 11:48:37 +0200
commitfc69469c5409601bd20b2fcc2775a0573c4a8074 (patch)
tree73837e6a32ff1bcda57fc897f785563a411904ba /zencore/include
parentWrong include for std::runtime_error (diff)
downloadzen-fc69469c5409601bd20b2fcc2775a0573c4a8074.tar.xz
zen-fc69469c5409601bd20b2fcc2775a0573c4a8074.zip
Removed constexpr for anything that uses GetSize()
With the change from Ptr/Size to Ptr/EndPtr and the introduction of GetSize(), there are some constexpr-marked methods that previously used Size that now call GetSize(). GCC raises an error because GetSize() is not a constexpr. If GetSize() is marked constexpt, MSVC raises an error saying that GetSize() cannot be a constexpr. Only solution is to remove the constexpr from anything calling GetSize() (which in turn cascades).
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/memory.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/zencore/include/zencore/memory.h b/zencore/include/zencore/memory.h
index 1f948d3bb..9d6339595 100644
--- a/zencore/include/zencore/memory.h
+++ b/zencore/include/zencore/memory.h
@@ -83,10 +83,10 @@ struct MutableMemoryView
{
}
- inline bool IsEmpty() const { return m_Data == m_DataEnd; }
- void* GetData() const { return m_Data; }
- void* GetDataEnd() const { return m_DataEnd; }
- constexpr size_t GetSize() const { return reinterpret_cast<uint8_t*>(m_DataEnd) - reinterpret_cast<uint8_t*>(m_Data); }
+ inline bool IsEmpty() const { return m_Data == m_DataEnd; }
+ void* GetData() const { return m_Data; }
+ void* GetDataEnd() const { return m_DataEnd; }
+ size_t GetSize() const { return reinterpret_cast<uint8_t*>(m_DataEnd) - reinterpret_cast<uint8_t*>(m_Data); }
inline bool EqualBytes(const MutableMemoryView& InView) const
{
@@ -113,7 +113,7 @@ struct MutableMemoryView
}
/** Modifies the view by chopping the given number of bytes from the left. */
- inline constexpr void RightChopInline(uint64_t InSize)
+ inline void RightChopInline(uint64_t InSize)
{
const uint64_t Offset = zen::Min(GetSize(), InSize);
m_Data = GetDataAtOffsetNoCheck(Offset);
@@ -153,7 +153,7 @@ struct MutableMemoryView
return View;
}
- inline constexpr MutableMemoryView& operator+=(size_t InSize)
+ inline MutableMemoryView& operator+=(size_t InSize)
{
RightChopInline(InSize);
return *this;
@@ -194,11 +194,11 @@ struct MemoryView
{
}
- inline bool Contains(const MemoryView& Other) const { return (m_Data <= Other.m_Data) && (m_DataEnd >= Other.m_DataEnd); }
- inline bool IsEmpty() const { return m_Data == m_DataEnd; }
- const void* GetData() const { return m_Data; }
- const void* GetDataEnd() const { return m_DataEnd; }
- constexpr size_t GetSize() const { return reinterpret_cast<const uint8_t*>(m_DataEnd) - reinterpret_cast<const uint8_t*>(m_Data); }
+ inline bool Contains(const MemoryView& Other) const { return (m_Data <= Other.m_Data) && (m_DataEnd >= Other.m_DataEnd); }
+ inline bool IsEmpty() const { return m_Data == m_DataEnd; }
+ const void* GetData() const { return m_Data; }
+ const void* GetDataEnd() const { return m_DataEnd; }
+ size_t GetSize() const { return reinterpret_cast<const uint8_t*>(m_DataEnd) - reinterpret_cast<const uint8_t*>(m_Data); }
inline bool operator==(const MemoryView& Rhs) const { return m_Data == Rhs.m_Data && m_DataEnd == Rhs.m_DataEnd; }
inline bool EqualBytes(const MemoryView& InView) const
@@ -208,14 +208,14 @@ struct MemoryView
return Size == InView.GetSize() && (memcmp(m_Data, InView.GetData(), Size) == 0);
}
- inline constexpr MemoryView& operator+=(size_t InSize)
+ inline MemoryView& operator+=(size_t InSize)
{
RightChopInline(InSize);
return *this;
}
/** Modifies the view by chopping the given number of bytes from the left. */
- inline constexpr void RightChopInline(uint64_t InSize)
+ inline void RightChopInline(uint64_t InSize)
{
const uint64_t Offset = std::min(GetSize(), InSize);
m_Data = GetDataAtOffsetNoCheck(Offset);
@@ -246,7 +246,7 @@ struct MemoryView
}
/** Returns the left-most part of the view by taking the given number of bytes from the left. */
- constexpr inline MemoryView Left(uint64_t InSize) const
+ inline MemoryView Left(uint64_t InSize) const
{
MemoryView View(*this);
View.LeftInline(InSize);
@@ -254,7 +254,7 @@ struct MemoryView
}
/** Modifies the view to be the given number of bytes from the left. */
- constexpr inline void LeftInline(uint64_t InSize)
+ inline void LeftInline(uint64_t InSize)
{
InSize = zen::Min(GetSize(), InSize);
m_DataEnd = std::min(m_DataEnd, m_Data + InSize);
@@ -298,28 +298,28 @@ MutableMemoryView::CopyFrom(MemoryView InView) const
}
/** Advances the start of the view by an offset, which is clamped to stay within the view. */
-constexpr inline MemoryView
+inline MemoryView
operator+(const MemoryView& View, uint64_t Offset)
{
return MemoryView(View) += Offset;
}
/** Advances the start of the view by an offset, which is clamped to stay within the view. */
-constexpr inline MemoryView
+inline MemoryView
operator+(uint64_t Offset, const MemoryView& View)
{
return MemoryView(View) += Offset;
}
/** Advances the start of the view by an offset, which is clamped to stay within the view. */
-constexpr inline MutableMemoryView
+inline MutableMemoryView
operator+(const MutableMemoryView& View, uint64_t Offset)
{
return MutableMemoryView(View) += Offset;
}
/** Advances the start of the view by an offset, which is clamped to stay within the view. */
-constexpr inline MutableMemoryView
+inline MutableMemoryView
operator+(uint64_t Offset, const MutableMemoryView& View)
{
return MutableMemoryView(View) += Offset;