16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28a1ab315SDavid Howells #ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG
38a1ab315SDavid Howells #define _UAPI__ASM_GENERIC_BITS_PER_LONG
48a1ab315SDavid Howells 
58386f58fSTiezhu Yang #ifndef __BITS_PER_LONG
68386f58fSTiezhu Yang /*
78386f58fSTiezhu Yang  * In order to keep safe and avoid regression, only unify uapi
88386f58fSTiezhu Yang  * bitsperlong.h for some archs which are using newer toolchains
98386f58fSTiezhu Yang  * that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__.
108386f58fSTiezhu Yang  * See the following link for more info:
118386f58fSTiezhu Yang  * https://lore.kernel.org/linux-arch/[email protected]/
128386f58fSTiezhu Yang  */
138386f58fSTiezhu Yang #if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__)
148386f58fSTiezhu Yang #define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
158386f58fSTiezhu Yang #else
168a1ab315SDavid Howells /*
178a1ab315SDavid Howells  * There seems to be no way of detecting this automatically from user
188a1ab315SDavid Howells  * space, so 64 bit architectures should override this in their
198a1ab315SDavid Howells  * bitsperlong.h. In particular, an architecture that supports
208a1ab315SDavid Howells  * both 32 and 64 bit user space must not rely on CONFIG_64BIT
218a1ab315SDavid Howells  * to decide it, but rather check a compiler provided macro.
228a1ab315SDavid Howells  */
238a1ab315SDavid Howells #define __BITS_PER_LONG 32
248a1ab315SDavid Howells #endif
258386f58fSTiezhu Yang #endif
268a1ab315SDavid Howells 
27*3c7a8e19SPaolo Bonzini #ifndef __BITS_PER_LONG_LONG
28*3c7a8e19SPaolo Bonzini #define __BITS_PER_LONG_LONG 64
29*3c7a8e19SPaolo Bonzini #endif
30*3c7a8e19SPaolo Bonzini 
318a1ab315SDavid Howells #endif /* _UAPI__ASM_GENERIC_BITS_PER_LONG */
32