linux/tools/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
__ffz.h tools lib: Add for_each_clear_bit macro 2016-10-24 11:07:33 -03:00
__fls.h bitops: Change function return types from long to int 2024-05-03 17:04:50 +02:00
arch_hweight.h tools/headers: Synchronize kernel ABI headers 2017-11-04 09:27:46 +01:00
atomic.h tools: KVM: selftests: Convert clear/set_bit() to actual atomics 2022-12-02 13:22:35 -05:00
const_hweight.h tools/headers: Synchronize kernel ABI headers 2017-11-04 09:27:46 +01:00
fls.h tools/include: Sync asm-generic/bitops/fls.h with the kernel sources 2024-04-11 10:38:29 -07:00
fls64.h tools/headers: Synchronize kernel ABI headers 2017-11-04 09:27:46 +01:00
hweight.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
non-atomic.h bitops: wrap non-atomic bitops with a transparent macro 2022-06-30 19:52:41 -07:00