xref: /rk3399_rockchip-uboot/arch/mips/include/asm/const.h (revision 23ff8633fd8ca75d2ffd4595b9c72bb1a5fdbd20)
1*23ff8633SDaniel Schwierzeck /* const.h: Macros for dealing with constants.  */
2*23ff8633SDaniel Schwierzeck 
3*23ff8633SDaniel Schwierzeck #ifndef _LINUX_CONST_H
4*23ff8633SDaniel Schwierzeck #define _LINUX_CONST_H
5*23ff8633SDaniel Schwierzeck 
6*23ff8633SDaniel Schwierzeck /* Some constant macros are used in both assembler and
7*23ff8633SDaniel Schwierzeck  * C code.  Therefore we cannot annotate them always with
8*23ff8633SDaniel Schwierzeck  * 'UL' and other type specifiers unilaterally.  We
9*23ff8633SDaniel Schwierzeck  * use the following macros to deal with this.
10*23ff8633SDaniel Schwierzeck  *
11*23ff8633SDaniel Schwierzeck  * Similarly, _AT() will cast an expression with a type in C, but
12*23ff8633SDaniel Schwierzeck  * leave it unchanged in asm.
13*23ff8633SDaniel Schwierzeck  */
14*23ff8633SDaniel Schwierzeck 
15*23ff8633SDaniel Schwierzeck #ifdef __ASSEMBLY__
16*23ff8633SDaniel Schwierzeck #define _AC(X,Y)	X
17*23ff8633SDaniel Schwierzeck #define _AT(T,X)	X
18*23ff8633SDaniel Schwierzeck #else
19*23ff8633SDaniel Schwierzeck #define __AC(X,Y)	(X##Y)
20*23ff8633SDaniel Schwierzeck #define _AC(X,Y)	__AC(X,Y)
21*23ff8633SDaniel Schwierzeck #define _AT(T,X)	((T)(X))
22*23ff8633SDaniel Schwierzeck #endif
23*23ff8633SDaniel Schwierzeck 
24*23ff8633SDaniel Schwierzeck #define _BITUL(x)	(_AC(1,UL) << (x))
25*23ff8633SDaniel Schwierzeck #define _BITULL(x)	(_AC(1,ULL) << (x))
26*23ff8633SDaniel Schwierzeck 
27*23ff8633SDaniel Schwierzeck #endif /* !(_LINUX_CONST_H) */
28