xref: /aosp_15_r20/external/bpftool/include/uapi/asm-generic/bitsperlong.h (revision 858ea5e570667251cdc31d3fe7b846b591105938)
1*858ea5e5SAndroid Build Coastguard Worker /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*858ea5e5SAndroid Build Coastguard Worker #ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG
3*858ea5e5SAndroid Build Coastguard Worker #define _UAPI__ASM_GENERIC_BITS_PER_LONG
4*858ea5e5SAndroid Build Coastguard Worker 
5*858ea5e5SAndroid Build Coastguard Worker #ifndef __BITS_PER_LONG
6*858ea5e5SAndroid Build Coastguard Worker /*
7*858ea5e5SAndroid Build Coastguard Worker  * In order to keep safe and avoid regression, only unify uapi
8*858ea5e5SAndroid Build Coastguard Worker  * bitsperlong.h for some archs which are using newer toolchains
9*858ea5e5SAndroid Build Coastguard Worker  * that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__.
10*858ea5e5SAndroid Build Coastguard Worker  * See the following link for more info:
11*858ea5e5SAndroid Build Coastguard Worker  * https://lore.kernel.org/linux-arch/[email protected]/
12*858ea5e5SAndroid Build Coastguard Worker  */
13*858ea5e5SAndroid Build Coastguard Worker #if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__)
14*858ea5e5SAndroid Build Coastguard Worker #define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
15*858ea5e5SAndroid Build Coastguard Worker #else
16*858ea5e5SAndroid Build Coastguard Worker /*
17*858ea5e5SAndroid Build Coastguard Worker  * There seems to be no way of detecting this automatically from user
18*858ea5e5SAndroid Build Coastguard Worker  * space, so 64 bit architectures should override this in their
19*858ea5e5SAndroid Build Coastguard Worker  * bitsperlong.h. In particular, an architecture that supports
20*858ea5e5SAndroid Build Coastguard Worker  * both 32 and 64 bit user space must not rely on CONFIG_64BIT
21*858ea5e5SAndroid Build Coastguard Worker  * to decide it, but rather check a compiler provided macro.
22*858ea5e5SAndroid Build Coastguard Worker  */
23*858ea5e5SAndroid Build Coastguard Worker #define __BITS_PER_LONG 32
24*858ea5e5SAndroid Build Coastguard Worker #endif
25*858ea5e5SAndroid Build Coastguard Worker #endif
26*858ea5e5SAndroid Build Coastguard Worker 
27*858ea5e5SAndroid Build Coastguard Worker #endif /* _UAPI__ASM_GENERIC_BITS_PER_LONG */
28