diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-12 16:00:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-12 16:00:05 -0700 |
| commit | 261b2f1f2bc13ccf7db5ec68c825ffc7b0781f7f (patch) | |
| tree | 4953e376e705a8110cb8164dda5b239c04f2768b /source/core/slang-common.h | |
| parent | bbd9c2e6d7b57f5acc3238083ab2f7c7b140df5e (diff) | |
Use scratchData on `IRInst` to replace HashSets. (#2978)
* Use scratchData on `IRInst` to replace HashSets.
* Update test results.
* Initialize scratchData.
* Update autodiff documentation.
* Use enum instead of bool.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/core/slang-common.h')
| -rw-r--r-- | source/core/slang-common.h | 6 |
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? |
