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