From ddf5ef101775284a65fb28ec8303bd92f0690306 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 23 Mar 2016 22:21:11 -0400 Subject: [PATCH] Fix set_bit_le() type width problems The swizzle value was defined in terms of longs but the code used u64s. And the bare shifted value was an int so it'd get truncated. Switch it all to using longs. The ratio of bugs to lines of code in that first attempt was through the roof! Signed-off-by: Zach Brown --- utils/src/bitops.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/src/bitops.h b/utils/src/bitops.h index dfe46a1c..5ac429fc 100644 --- a/utils/src/bitops.h +++ b/utils/src/bitops.h @@ -10,11 +10,11 @@ static inline void set_bit_le(int nr, void *addr) { - u64 *dwords = addr; + unsigned long *longs = addr; nr ^= BITOP_LE_SWIZZLE; - dwords[nr / 64] |= 1 << (nr & 63); + longs[nr / BITS_PER_LONG] |= 1UL << (nr & (BITS_PER_LONG - 1)); } #endif