summaryrefslogtreecommitdiff
path: root/src/dict.c
diff options
context:
space:
mode:
authorMuhammad Zahalqa <m@tryfinally.com>2020-05-04 12:36:01 +0300
committerMuhammad Zahalqa <m@tryfinally.com>2020-05-04 12:36:01 +0300
commit4477ee33ac1354b3eecc581e48227d96d14f6c94 (patch)
tree9007a732cc7d5fe518aa4200e60d7b95ddc58640 /src/dict.c
parent70a80ef3ad5f46ed79e1336fed7b81f92edce6fb (diff)
downloadredis-4477ee33ac1354b3eecc581e48227d96d14f6c94.tar.gz
Fix compiler warnings on function rev(unsigned long)
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c6
1 files changed, 3 insertions, 3 deletions
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);
}