summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-common.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/core/slang-common.h b/source/core/slang-common.h
index 5cf0432f2..62c73df08 100644
--- a/source/core/slang-common.h
+++ b/source/core/slang-common.h
@@ -76,6 +76,12 @@ namespace Slang
template <typename T>
SLANG_FORCE_INLINE T* clone(IClonable* clonable) { return (T*)clonable->clone(T::getTypeGuid()); }
+ template <typename T>
+ inline bool isBitSet(T value, T bitToTest)
+ {
+ static_assert(sizeof(T) <= sizeof(uint32_t), "Only support up to 32 bit enums");
+ return (T)((uint32_t)value & (uint32_t)bitToTest) == bitToTest;
+ }
}
// TODO: Shouldn't these be SLANG_ prefixed?