blob: 0a7eb8322320c6526473cc16899030ecd6af2957 [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__
Daniel Schwierzeck23ff8632016-01-12 21:48:25 +010020#define _AT(T,X) X
21#else
Daniel Schwierzeck23ff8632016-01-12 21:48:25 +010022#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) */