DWORD dwLevel = 0;
DWORD dwShifted;
- // Generate 32 uniformly distributed pseudo-random bits using the Park-Miller Lehmer Minimal Standard Random Number Generator.
+ // Generate 31 uniformly distributed pseudo-random bits using the Park-Miller Lehmer Minimal Standard Random Number Generator.
dwRandom = (DWORD)(((ULONGLONG)dwRandom * 48271UL) % 2147483647UL);
- // Shift out (32 - SKIPLIST_LEVELS) bits to the right to have no more than SKIPLIST_LEVELS bits set.
- dwShifted = dwRandom >> (32 - SKIPLIST_LEVELS);
+ // Shift out (31 - SKIPLIST_LEVELS) bits to the right to have no more than SKIPLIST_LEVELS bits set.
+ dwShifted = dwRandom >> (31 - SKIPLIST_LEVELS);
// BitScanForward doesn't operate on a zero input value.
if (dwShifted)
BitScanForward(&dwLevel, dwShifted);
}
- // dwLevel can't have a value higher than 31 this way, so a CHAR is more than enough.
+ // dwLevel can't have a value higher than 30 this way, so a CHAR is more than enough.
return (CHAR)dwLevel;
}
#ifndef _REACTOS_SKIPLIST_H
#define _REACTOS_SKIPLIST_H
-// Define SKIPLIST_LEVELS to a value between 1 and 32 before including this header.
+// Define SKIPLIST_LEVELS to a value between 1 and 31 before including this header.
// This specifies the maximum number of levels you want your Skiplist to have.
// A value of X is recommended for handling up to 2^X elements.
#ifndef SKIPLIST_LEVELS
-#error Please define SKIPLIST_LEVELS to a value between 1 and 32.
+#error Please define SKIPLIST_LEVELS to a value between 1 and 31.
#endif
C_ASSERT(SKIPLIST_LEVELS >= 1);
-C_ASSERT(SKIPLIST_LEVELS <= 32);
+C_ASSERT(SKIPLIST_LEVELS <= 31);
// Function pointer definitions
typedef PVOID (WINAPI *PSKIPLIST_ALLOCATE_ROUTINE)(DWORD);