val |= val >> 4;
val |= val >> 8;
val |= val >> 16;
- return DeBruijnClz[(val * 0x07C4ACDDU) >> 27] ^ 31;
+ return 31 - DeBruijnClz[(val * 0x07C4ACDDU) >> 27];
}
}
if (val != 0) {
unsigned long r;
_BitScanReverse(&r, val);
- return (unsigned)(r ^ 31);
+ return (unsigned)(31 - r);
} else {
/* Should not reach this code path */
__assume(0);
if (val != 0) {
unsigned long r;
_BitScanReverse64(&r, val);
- return (unsigned)(r ^ 63);
+ return (unsigned)(63 - r);
} else {
/* Should not reach this code path */
__assume(0);
MEM_STATIC unsigned ZSTD_highbit32(U32 val) /* compress, dictBuilder, decodeCorpus */
{
assert(val != 0);
- return ZSTD_countLeadingZeros32(val) ^ 31;
+ return 31 - ZSTD_countLeadingZeros32(val);
}
#endif /* ZSTD_BITS_H */
}
DISPLAYLEVEL(3, "OK \n");
- DISPLAYLEVEL(3, "test%3i : testing bitwise instrinsics PR#3045: ", testNb++);
+ DISPLAYLEVEL(3, "test%3i : testing bitwise intrinsics PR#3045: ", testNb++);
{
U32 seed_copy = seed; // need non-const seed to avoid compiler warning for FUZ_rand(&seed)
U32 rand32 = FUZ_rand(&seed_copy);