1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2bb970707SArnaldo Carvalho de Melo #ifndef __ASM_GENERIC_BITS_PER_LONG 3bb970707SArnaldo Carvalho de Melo #define __ASM_GENERIC_BITS_PER_LONG 4bb970707SArnaldo Carvalho de Melo 5bb970707SArnaldo Carvalho de Melo #include <uapi/asm-generic/bitsperlong.h> 6bb970707SArnaldo Carvalho de Melo 72a00f026SArnaldo Carvalho de Melo #ifdef __SIZEOF_LONG__ 8e81fcd43SPeter Zijlstra #define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__) 92a00f026SArnaldo Carvalho de Melo #else 10e81fcd43SPeter Zijlstra #define BITS_PER_LONG __WORDSIZE 112a00f026SArnaldo Carvalho de Melo #endif 12bb970707SArnaldo Carvalho de Melo 132a00f026SArnaldo Carvalho de Melo #if BITS_PER_LONG != __BITS_PER_LONG 14bb970707SArnaldo Carvalho de Melo #error Inconsistent word size. Check asm/bitsperlong.h 15bb970707SArnaldo Carvalho de Melo #endif 16bb970707SArnaldo Carvalho de Melo 17bb970707SArnaldo Carvalho de Melo #ifndef BITS_PER_LONG_LONG 18bb970707SArnaldo Carvalho de Melo #define BITS_PER_LONG_LONG 64 19bb970707SArnaldo Carvalho de Melo #endif 20bb970707SArnaldo Carvalho de Melo 21*78e48f06SYury Norov #define small_const_nbits(nbits) \ 22*78e48f06SYury Norov (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0) 23*78e48f06SYury Norov 24bb970707SArnaldo Carvalho de Melo #endif /* __ASM_GENERIC_BITS_PER_LONG */ 25