-
Notifications
You must be signed in to change notification settings - Fork 90
Closed
Description
I believe this will fail if size_t is 64 bits or more and the value is requested is also more than 2^32.
Lines 19 to 30 in c927821
size_t get_power_of_two(size_t n) | |
{ | |
n--; | |
n |= n >> 1; | |
n |= n >> 2; | |
n |= n >> 4; | |
n |= n >> 8; | |
n |= n >> 16; | |
n++; | |
return n; | |
} |
Adding a similar right shift of 32 bits would solve the problem for situations when size_t has 64 bits.
ValarDragon
Metadata
Metadata
Assignees
Labels
No labels