Daniel Schwierzeck | 898582b | 2016-01-12 21:48:27 +0100 | [diff] [blame] | 1 | /* |
| 2 | * const.h: Macros for dealing with constants. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0 |
| 5 | */ |
Daniel Schwierzeck | 23ff863 | 2016-01-12 21:48:25 +0100 | [diff] [blame] | 6 | |
| 7 | #ifndef _LINUX_CONST_H |
| 8 | #define _LINUX_CONST_H |
| 9 | |
| 10 | /* Some constant macros are used in both assembler and |
| 11 | * C code. Therefore we cannot annotate them always with |
| 12 | * 'UL' and other type specifiers unilaterally. We |
| 13 | * use the following macros to deal with this. |
| 14 | * |
| 15 | * Similarly, _AT() will cast an expression with a type in C, but |
| 16 | * leave it unchanged in asm. |
| 17 | */ |
| 18 | |
| 19 | #ifdef __ASSEMBLY__ |
| 20 | #define _AC(X,Y) X |
| 21 | #define _AT(T,X) X |
| 22 | #else |
| 23 | #define __AC(X,Y) (X##Y) |
| 24 | #define _AC(X,Y) __AC(X,Y) |
| 25 | #define _AT(T,X) ((T)(X)) |
| 26 | #endif |
| 27 | |
| 28 | #define _BITUL(x) (_AC(1,UL) << (x)) |
| 29 | #define _BITULL(x) (_AC(1,ULL) << (x)) |
| 30 | |
| 31 | #endif /* !(_LINUX_CONST_H) */ |