blob: c872bfd25e139115014764018072beb171dd23ad [file] [log] [blame]
Vivek Goyal9d291e72007-05-02 19:27:06 +02001/* const.h: Macros for dealing with constants. */
2
Randy Dunlap6df95fd2007-05-08 00:31:11 -07003#ifndef _LINUX_CONST_H
4#define _LINUX_CONST_H
Vivek Goyal9d291e72007-05-02 19:27:06 +02005
6/* Some constant macros are used in both assembler and
7 * C code. Therefore we cannot annotate them always with
Randy Dunlap6df95fd2007-05-08 00:31:11 -07008 * 'UL' and other type specifiers unilaterally. We
Vivek Goyal9d291e72007-05-02 19:27:06 +02009 * use the following macros to deal with this.
Jeremy Fitzhardinge74ef6492008-01-30 13:32:42 +010010 *
11 * Similarly, _AT() will cast an expression with a type in C, but
12 * leave it unchanged in asm.
Vivek Goyal9d291e72007-05-02 19:27:06 +020013 */
14
15#ifdef __ASSEMBLY__
16#define _AC(X,Y) X
Jeremy Fitzhardinge74ef6492008-01-30 13:32:42 +010017#define _AT(T,X) X
Vivek Goyal9d291e72007-05-02 19:27:06 +020018#else
19#define __AC(X,Y) (X##Y)
20#define _AC(X,Y) __AC(X,Y)
Jeremy Fitzhardinge74ef6492008-01-30 13:32:42 +010021#define _AT(T,X) ((T)(X))
Vivek Goyal9d291e72007-05-02 19:27:06 +020022#endif
23
H. Peter Anvin2fc016c2013-04-27 16:07:49 -070024#define _BITUL(x) (_AC(1,UL) << (x))
25#define _BITULL(x) (_AC(1,ULL) << (x))
26
Randy Dunlap6df95fd2007-05-08 00:31:11 -070027#endif /* !(_LINUX_CONST_H) */