summaryrefslogtreecommitdiff
path: root/prelude/slang-cpp-types.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-10-07 00:30:10 -0700
committerGitHub <noreply@github.com>2020-10-07 00:30:10 -0700
commit55cd4210ecff75523699337704f7561f8c11a26e (patch)
tree5f205b93f7cc7da8f7e2ee315bd4f8ea11f90100 /prelude/slang-cpp-types.h
parent4ad2e52662a00f7d8b25be6d451bba33ba62947f (diff)
Fix C++ emit for `bit_cast` inst. (#1570)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'prelude/slang-cpp-types.h')
-rw-r--r--prelude/slang-cpp-types.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/prelude/slang-cpp-types.h b/prelude/slang-cpp-types.h
index b0a9c68f6..9c8fb3dec 100644
--- a/prelude/slang-cpp-types.h
+++ b/prelude/slang-cpp-types.h
@@ -1036,6 +1036,12 @@ struct ComputeVaryingInput
typedef void(*ComputeThreadFunc)(ComputeThreadVaryingInput* varyingInput, void* uniformEntryPointParams, void* uniformState);
typedef void(*ComputeFunc)(ComputeVaryingInput* varyingInput, void* uniformEntryPointParams, void* uniformState);
+template<typename TResult, typename TInput>
+TResult slang_bit_cast(TInput val)
+{
+ return *(TResult*)(&val);
+}
+
#ifdef SLANG_PRELUDE_NAMESPACE
}
#endif