Fix compiler warnings on function rev(unsigned long)
This commit is contained in:
parent
6b8fdaa8d6
commit
6bbfb97a89
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user