From 4477ee33ac1354b3eecc581e48227d96d14f6c94 Mon Sep 17 00:00:00 2001 From: Muhammad Zahalqa Date: Mon, 4 May 2020 12:36:01 +0300 Subject: Fix compiler warnings on function rev(unsigned long) --- src/dict.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dict.c') diff --git a/src/dict.c b/src/dict.c index ac6f8cfde..57619c280 100644 --- a/src/dict.c +++ b/src/dict.c @@ -766,9 +766,9 @@ dictEntry *dictGetFairRandomKey(dict *d) { /* Function to reverse bits. Algorithm from: * http://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel */ static unsigned long rev(unsigned long v) { - unsigned long s = 8 * sizeof(v); // bit size; must be power of 2 - unsigned long mask = ~0; - while ((s >>= 1) > 0) { + unsigned long s = CHAR_BIT * sizeof(v); // bit size; must be power of 2 + unsigned long mask = ~0UL; + while ((s >>= 1) > 0UL) { mask ^= (mask << s); v = ((v >> s) & mask) | ((v << s) & ~mask); } -- cgit v1.2.1