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 <mary.guillemard@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32939>
This commit is contained in:

committed by
Marge Bot

parent
9ba38350de
commit
bd872e2aaa
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user