Skip to content
Snippets Groups Projects
Commit dbc3f839 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Jean-Baptiste Kempf
Browse files

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.
parent bea0af00
No related branches found
No related tags found
1 merge request!6087stdbit: fix CTZ fall-back
Pipeline #520668 passed with stages
in 40 minutes and 22 seconds
......@@ -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--;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment