Another bitops fallback impl fix

This commit is contained in:
Behdad Esfahbod 2018-02-16 18:20:12 -08:00
parent f18b9fbf65
commit 4e517ecb6b

View File

@ -402,28 +402,28 @@ _hb_bit_storage (T v)
/* "bithacks" */
const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
const unsigned int S[] = {1, 2, 4, 8, 16};
unsigned int r = 1;
unsigned int r = 0;
for (int i = 4; i >= 0; i--)
if (v & b[i])
{
v >>= S[i];
r |= S[i];
}
return r;
return r + 1;
}
if (sizeof (T) <= 8)
{
/* "bithacks" */
const uint64_t b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000, 0xFFFFFFFF00000000};
const unsigned int S[] = {1, 2, 4, 8, 16, 32};
unsigned int r = 1;
unsigned int r = 0;
for (int i = 5; i >= 0; i--)
if (v & b[i])
{
v >>= S[i];
r |= S[i];
}
return r;
return r + 1;
}
if (sizeof (T) == 16)
{