util-math: Fix is_power_of_two_loop for non-64-bit types

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-09-28 21:21:40 +02:00
parent 6e03f2334d
commit bc89eaf33a

View file

@ -91,7 +91,7 @@ namespace util {
inline bool is_power_of_two_loop(T v)
{
bool have_bit = false;
for (size_t index = 63; index >= 0; index--) {
for (size_t index = 0; index < (sizeof(T) * 8); index++) {
bool cur = (v & (1ull << index)) != 0;
if (cur) {
if (have_bit)