diff options
Diffstat (limited to 'include/linux/const.h')
-rw-r--r-- | include/linux/const.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/const.h b/include/linux/const.h index c872bfd25e..77e4f6fd8a 100644 --- a/include/linux/const.h +++ b/include/linux/const.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + /* const.h: Macros for dealing with constants. */ #ifndef _LINUX_CONST_H @@ -21,7 +23,22 @@ #define _AT(T,X) ((T)(X)) #endif -#define _BITUL(x) (_AC(1,UL) << (x)) -#define _BITULL(x) (_AC(1,ULL) << (x)) +#define _UL(x) (_AC(x, UL)) +#define _ULL(x) (_AC(x, ULL)) + +#define _BITUL(x) (_UL(1) << (x)) +#define _BITULL(x) (_ULL(1) << (x)) + +#define UL(x) (_UL(x)) +#define ULL(x) (_ULL(x)) + + +/* + * This returns a constant expression while determining if an argument is + * a constant expression, most importantly without evaluating the argument. + * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de> + */ +#define __is_constexpr(x) \ + (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) #endif /* !(_LINUX_CONST_H) */ |