Skip to content

Commit

Permalink
common: clang supports __builtin_clz also in non-GNU modes
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Jun 5, 2024
1 parent 0fd3fe8 commit 00cfe1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ char **mp_dup_str_array(void *tctx, char **s)
// mp_log2(32) == 5
unsigned int mp_log2(uint32_t v)
{
#if defined(__GNUC__) && __GNUC__ >= 4
#if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)
return v ? 31 - __builtin_clz(v) : 0;
#else
for (int x = 31; x >= 0; x--) {
Expand Down

0 comments on commit 00cfe1e

Please sign in to comment.