linux/include/asm-generic/bitops
Thorsten Blum 9c313ccdfc
bitops: Change function return types from long to int
Change the return types of bitops functions (ffs, fls, and fns) from
long to int. The expected return values are in the range [0, 64], for
which int is sufficient.

Additionally, int aligns well with the return types of the corresponding
__builtin_* functions, potentially reducing overall type conversions.

Many of the existing bitops functions already return an int and don't
need to be changed. The bitops functions in arch/ should be considered
separately.

Adjust some return variables to match the function return types.

With GCC 13 and defconfig, these changes reduced the size of a test
kernel image by 5,432 bytes on arm64 and by 248 bytes on riscv; there
were no changes in size on x86_64, powerpc, or m68k.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-05-03 17:04:50 +02:00
..
__ffs.h bitops: Change function return types from long to int 2024-05-03 17:04:50 +02:00
__fls.h bitops: Change function return types from long to int 2024-05-03 17:04:50 +02:00
arch_hweight.h
atomic.h locking/atomic: treewide: use raw_atomic*_<op>() 2023-06-05 09:57:20 +02:00
builtin-__ffs.h bitops: Change function return types from long to int 2024-05-03 17:04:50 +02:00
builtin-__fls.h bitops: Change function return types from long to int 2024-05-03 17:04:50 +02:00
builtin-ffs.h asm-generic: ffs: Drop bogus reference to ffz location 2021-08-11 11:38:10 +02:00
builtin-fls.h fls: change parameter to unsigned int 2019-01-04 13:13:46 -08:00
const_hweight.h
ext2-atomic-setbit.h
ext2-atomic.h
ffs.h riscv: Avoid code duplication with generic bitops implementation 2024-01-24 17:25:36 -08:00
ffz.h
fls64.h
fls.h riscv: Avoid code duplication with generic bitops implementation 2024-01-24 17:25:36 -08:00
generic-non-atomic.h wait_on_bit: add an acquire memory barrier 2022-08-26 09:30:25 -07:00
hweight.h
instrumented-atomic.h asm-generic/bitops: Always inline all bit manipulation helpers 2022-01-25 22:30:28 +01:00
instrumented-lock.h mm: delete checks for xor_unlock_is_negative_byte() 2023-10-18 14:34:17 -07:00
instrumented-non-atomic.h wait_on_bit: add an acquire memory barrier 2022-08-26 09:30:25 -07:00
le.h bitops: move find_bit_*_le functions from le.h to find.h 2022-01-15 08:47:30 -08:00
lock.h mm: delete checks for xor_unlock_is_negative_byte() 2023-10-18 14:34:17 -07:00
non-atomic.h wait_on_bit: add an acquire memory barrier 2022-08-26 09:30:25 -07:00
non-instrumented-non-atomic.h wait_on_bit: add an acquire memory barrier 2022-08-26 09:30:25 -07:00
sched.h