Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /* const.h: Macros for dealing with constants.  */
0003 
0004 #ifndef _UAPI_LINUX_CONST_H
0005 #define _UAPI_LINUX_CONST_H
0006 
0007 /* Some constant macros are used in both assembler and
0008  * C code.  Therefore we cannot annotate them always with
0009  * 'UL' and other type specifiers unilaterally.  We
0010  * use the following macros to deal with this.
0011  *
0012  * Similarly, _AT() will cast an expression with a type in C, but
0013  * leave it unchanged in asm.
0014  */
0015 
0016 #ifdef __ASSEMBLY__
0017 #define _AC(X,Y)    X
0018 #define _AT(T,X)    X
0019 #else
0020 #define __AC(X,Y)   (X##Y)
0021 #define _AC(X,Y)    __AC(X,Y)
0022 #define _AT(T,X)    ((T)(X))
0023 #endif
0024 
0025 #define _UL(x)      (_AC(x, UL))
0026 #define _ULL(x)     (_AC(x, ULL))
0027 
0028 #define _BITUL(x)   (_UL(1) << (x))
0029 #define _BITULL(x)  (_ULL(1) << (x))
0030 
0031 #define __ALIGN_KERNEL(x, a)        __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
0032 #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
0033 
0034 #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
0035 
0036 #endif /* _UAPI_LINUX_CONST_H */