From 00cfe1e1fd9d4268d3d37bac3b3f49c4fd79c24e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Tue, 4 Jun 2024 18:58:55 +0200 Subject: [PATCH] common: clang supports __builtin_clz also in non-GNU modes --- common/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/common.c b/common/common.c index 7089a6674b29e..445ca646319eb 100644 --- a/common/common.c +++ b/common/common.c @@ -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--) {