stdbit: fix CTZ fall-back

The computed value was incorrect for types smaller than long long. The
code is not really used by anything at the moment, since we pretty much
compile with Clang or GCC only.
This commit is contained in:
Rémi Denis-Courmont 2024-09-24 20:23:54 +03:00 committed by Jean-Baptiste Kempf
parent bea0af00e8
commit dbc3f839d8

View File

@ -178,6 +178,8 @@ static inline unsigned int __stdc_trailing_zeros(unsigned long long value,
{
unsigned int zeros = size * CHAR_BIT;
values <<= (sizeof (value) * CHAR_BIT) - zeros;
while (value != 0) {
value <<= 1;
zeros--;