const.h 715 B

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