Skip to content

Commit

Permalink
Update: making value == 0 a UB in count_trailing_zeros_64
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed Aug 14, 2024
1 parent 51339e7 commit c241b49
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/hyperloglog.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,9 @@ static inline int32_t count_trailing_zeros_64(uint64_t value) {
return __builtin_ctzll(value);
#else
int bitpos = 0;
if (value) {
while (value & 1 == 0) {
value >>= 1;
++bitpos;
}
while (value & 1 == 0) {
value >>= 1;
++bitpos;
}
return bitpos;
#endif
Expand Down

0 comments on commit c241b49

Please sign in to comment.