瀏覽代碼

Suppress UBSAN warning

Jorrit Rouwe 3 年之前
父節點
當前提交
c830f38680
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Jolt/Core/HashCombine.h

+ 3 - 0
Jolt/Core/HashCombine.h

@@ -25,6 +25,9 @@ inline uint64 HashBytes(const void *inData, uint inSize, uint64 inSeed = 0xcbf29
 /// @brief Helper function that hashes a single value into ioSeed
 /// @brief Helper function that hashes a single value into ioSeed
 /// Taken from: https://stackoverflow.com/questions/2590677/how-do-i-combine-hash-values-in-c0x
 /// Taken from: https://stackoverflow.com/questions/2590677/how-do-i-combine-hash-values-in-c0x
 template <typename T>
 template <typename T>
+#ifdef JPH_COMPILER_CLANG
+	__attribute__((no_sanitize("unsigned-integer-overflow"))) // We intentionally overflow during hashing
+#endif
 inline void HashCombineHelper(size_t &ioSeed, const T &inValue)
 inline void HashCombineHelper(size_t &ioSeed, const T &inValue)
 {
 {
 	std::hash<T> hasher;
 	std::hash<T> hasher;