[PATCH] erofs-utils: fix bitops fls_long
Hongzhen Luo
hongzhen at linux.alibaba.com
Tue Jul 9 12:20:31 AEST 2024
The __builtin_clz is for unsigned int, while it is applied
to unsigned long. This fixes it by using __builtin_clzl.
Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
---
include/erofs/defs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/erofs/defs.h b/include/erofs/defs.h
index e0798c8..310a6ab 100644
--- a/include/erofs/defs.h
+++ b/include/erofs/defs.h
@@ -288,7 +288,7 @@ static inline u32 get_unaligned_le64(const void *p)
static inline unsigned int fls_long(unsigned long x)
{
- return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
+ return x ? sizeof(x) * 8 - __builtin_clzl(x) : 0;
}
static inline unsigned long lowbit(unsigned long n)
--
2.43.5
More information about the Linux-erofs
mailing list