Daniel Schwierzeck | a518653 | 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 | b01d3e1 | 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__ |
Daniel Schwierzeck | b01d3e1 | 2016-01-12 21:48:25 +0100 | [diff] [blame] | 20 | #define _AT(T,X) X |
| 21 | #else |
Daniel Schwierzeck | b01d3e1 | 2016-01-12 21:48:25 +0100 | [diff] [blame] | 22 | #define _AT(T,X) ((T)(X)) |
| 23 | #endif |
| 24 | |
| 25 | #define _BITUL(x) (_AC(1,UL) << (x)) |
| 26 | #define _BITULL(x) (_AC(1,ULL) << (x)) |
| 27 | |
| 28 | #endif /* !(_LINUX_CONST_H) */ |