erofs-utils: fix bitops fls_long
PATCH v2 1/1 erofs-utils: fix bitops fls_long
The __builtin_clz is for unsigned int, while it is applied to unsigned long. This fixes it by using __builtin_clzl.
The parameter types for the calls referencing fls_long have been adjusted (e.g., roundup_pow_of_two in erofs_init_devices).
Signed-off-by Hongzhen Luo <[email protected]>
---
v2: The parameter types for the function calls affected by this fix have been updated.
v1: https://lore.kernel.org/all/[email protected]/
--- include/erofs/defs.h | 2 +- lib/super.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/erofs/defs.h +1 -1
@@ -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)
lib/super.c +1 -1
@@ -27,7 +27,7 @@ static bool check_layout_compatibility(struct erofs_sb_info *sbi,static int erofs_init_devices (struct erofs_sb_info *sbi,struct erofs_super_block *dsb) { -unsigned int ondisk_extradevs, i; +unsigned long ondisk_extradevs, i;erofs_off_t pos; sbi->total_blocks = sbi->primarydevice_blocks;
Signature · 1 line
2.43.5