ck_{ht,internal}: Explicitly use unsigned for bitwise operations.

ck_pring
Samy Al Bahra 12 years ago
parent 957e4aec5d
commit a7d79970e7

@ -52,7 +52,7 @@
#define CK_HT_BUCKET_SHIFT 1ULL #define CK_HT_BUCKET_SHIFT 1ULL
#endif #endif
#define CK_HT_BUCKET_LENGTH (1 << CK_HT_BUCKET_SHIFT) #define CK_HT_BUCKET_LENGTH (1U << CK_HT_BUCKET_SHIFT)
#define CK_HT_BUCKET_MASK (CK_HT_BUCKET_LENGTH - 1) #define CK_HT_BUCKET_MASK (CK_HT_BUCKET_LENGTH - 1)
#endif #endif

@ -88,7 +88,7 @@ ck_internal_bsf(unsigned long v)
const unsigned int s = sizeof(unsigned long) * 8 - 1; const unsigned int s = sizeof(unsigned long) * 8 - 1;
for (i = 0; i < s; i++) { for (i = 0; i < s; i++) {
if (v & (1 << (s - i))) if (v & (1U << (s - i)))
return i; return i;
} }
@ -102,7 +102,7 @@ ck_internal_bsf_64(uint64_t v)
const unsigned int s = sizeof(unsigned long) * 8 - 1; const unsigned int s = sizeof(unsigned long) * 8 - 1;
for (i = 0; i < s; i++) { for (i = 0; i < s; i++) {
if (v & (1 << (63 - i))) if (v & (1U << (63U - i)))
return i; return i;
} }

Loading…
Cancel
Save