Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / include / asm-generic / bitsperlong.h
blob2093d56ddd1169acd34300e76e35311bd0a0e48a
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_GENERIC_BITS_PER_LONG
3 #define __ASM_GENERIC_BITS_PER_LONG
5 #include <uapi/asm-generic/bitsperlong.h>
7 #ifdef __SIZEOF_LONG__
8 #define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
9 #else
10 #define BITS_PER_LONG __WORDSIZE
11 #endif
13 #if BITS_PER_LONG != __BITS_PER_LONG
14 #error Inconsistent word size. Check asm/bitsperlong.h
15 #endif
17 #ifndef BITS_PER_LONG_LONG
18 #define BITS_PER_LONG_LONG 64
19 #endif
21 #define small_const_nbits(nbits) \
22 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0)
24 #endif /* __ASM_GENERIC_BITS_PER_LONG */