diff options
author | 2024-05-09 15:43:17 +0000 | |
---|---|---|
committer | 2024-05-09 15:43:17 +0000 | |
commit | 5c636e3b4543a48cf64427cbf915af17cc7ded30 (patch) | |
tree | 22bdeb1213f7ca4dbbdc414579c9edd75ac0af96 | |
parent | ada82ac3773142277c6d20bba3b823409fbfa8ff (diff) | |
parent | 77527b9787e25d3f07896aba50d74008b43b1bcf (diff) |
Merge "Turn off integer overflow UBSAN checks for hash functions" into main
-rw-r--r-- | include/ftl/details/hash.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/ftl/details/hash.h b/include/ftl/details/hash.h index f9a7fa8d41..230ae51257 100644 --- a/include/ftl/details/hash.h +++ b/include/ftl/details/hash.h @@ -43,6 +43,7 @@ constexpr std::uint64_t shift_mix(std::uint64_t v) { return v ^ (v >> 47); } +__attribute__((no_sanitize("unsigned-integer-overflow"))) constexpr std::uint64_t hash_length_16(std::uint64_t u, std::uint64_t v) { constexpr std::uint64_t kPrime = 0x9ddfea08eb382d69ull; auto a = (u ^ v) * kPrime; @@ -58,6 +59,7 @@ constexpr std::uint64_t kPrime1 = 0xb492b66fbe98f273ull; constexpr std::uint64_t kPrime2 = 0x9ae16a3b2f90404full; constexpr std::uint64_t kPrime3 = 0xc949d7c7509e6557ull; +__attribute__((no_sanitize("unsigned-integer-overflow"))) inline std::uint64_t hash_length_0_to_16(const char* str, std::uint64_t length) { if (length > 8) { const auto a = read_unaligned(str); @@ -80,6 +82,7 @@ inline std::uint64_t hash_length_0_to_16(const char* str, std::uint64_t length) return kPrime2; } +__attribute__((no_sanitize("unsigned-integer-overflow"))) inline std::uint64_t hash_length_17_to_32(const char* str, std::uint64_t length) { const auto a = read_unaligned(str) * kPrime1; const auto b = read_unaligned(str + 8); @@ -89,6 +92,7 @@ inline std::uint64_t hash_length_17_to_32(const char* str, std::uint64_t length) a + rotate(b ^ kPrime3, 20) - c + length); } +__attribute__((no_sanitize("unsigned-integer-overflow"))) inline std::uint64_t hash_length_33_to_64(const char* str, std::uint64_t length) { auto z = read_unaligned(str + 24); auto a = read_unaligned(str) + (length + read_unaligned(str + length - 16)) * kPrime0; |