blob: f600e7a5b7565606e2a7b9b4e2d28f44c601c9b2 [file] [log] [blame]
Daniel Schwierzeck898582b2016-01-12 21:48:27 +01001/*
2 * const.h: Macros for dealing with constants.
3 *
4 * SPDX-License-Identifier: GPL-2.0
5 */
Daniel Schwierzeck23ff8632016-01-12 21:48:25 +01006
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) */