aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-22 17:26:54 +0200
committerStefan Boberg <[email protected]>2021-05-22 17:26:54 +0200
commit2f09ed7de117432677c152c476b96db3be72244b (patch)
tree9d11aef18e960f1476f40dc05149bb9f64b53db9 /zencore/include
parentAdded ZenContentType enum to iobuffer.h (diff)
downloadzen-2f09ed7de117432677c152c476b96db3be72244b.tar.xz
zen-2f09ed7de117432677c152c476b96db3be72244b.zip
Added static_assert to ensure content type fits in allocated space
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/iobuffer.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/zencore/include/zencore/iobuffer.h b/zencore/include/zencore/iobuffer.h
index a2ec6743d..a515f7af8 100644
--- a/zencore/include/zencore/iobuffer.h
+++ b/zencore/include/zencore/iobuffer.h
@@ -10,7 +10,7 @@ namespace zen {
struct IoBufferExtendedCore;
-enum class ZenContentType
+enum class ZenContentType : uint8_t
{
kBinary, // Note that since this is zero, this will be the default value in IoBuffer
kText,
@@ -170,6 +170,8 @@ protected:
kContentTypeMask = 0xf
};
+ static_assert((uint32_t(ZenContentType::kUnknownContentType) & ~kContentTypeMask) == 0);
+
enum Flags
{
kIsOwnedByThis = 1 << 0,