From bd872e2aaa8e4f08bbb33b8e6a8e10e44856ebd1 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Thu, 19 Dec 2024 11:58:58 +0100 Subject: [PATCH] util/bitpack_helpers: Use UINT64_MAX instead of ~0ULL This fixes issues with LLVM on OpenCL C failing to represent 128-bit integers. Signed-off-by: Mary Guillemard Reviewed-by: Alyssa Rosenzweig Part-of: --- src/util/bitpack_helpers.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/bitpack_helpers.h b/src/util/bitpack_helpers.h index 2e3122f97cc..25f3045ab49 100644 --- a/src/util/bitpack_helpers.h +++ b/src/util/bitpack_helpers.h @@ -50,7 +50,7 @@ ALWAYS_INLINE static uint64_t util_bitpack_ones(uint32_t start, uint32_t end) { - return (~0ull >> (64 - (end - start + 1))) << start; + return (UINT64_MAX >> (64 - (end - start + 1))) << start; } ALWAYS_INLINE static uint64_t @@ -136,7 +136,7 @@ util_bitpack_sfixed(float v, uint32_t start, uint32_t end, #endif const int64_t int_val = llroundf(v * factor); - const uint64_t mask = ~0ull >> (64 - (end - start + 1)); + const uint64_t mask = UINT64_MAX >> (64 - (end - start + 1)); return (int_val & mask) << start; } @@ -154,7 +154,7 @@ util_bitpack_sfixed_clamp(float v, uint32_t start, uint32_t end, const float max = u_intN_max(total_bits) / factor; const int64_t int_val = llroundf(CLAMP(v, min, max) * factor); - const uint64_t mask = ~0ull >> (64 - (end - start + 1)); + const uint64_t mask = UINT64_MAX >> (64 - (end - start + 1)); return (int_val & mask) << start; }