arch: Define INTx_C and UINTx_C macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia50ea8764880fabd3d878c95328632c761be6b43
This commit is contained in:
Xiang Xiao 2020-06-10 02:24:49 +08:00 committed by Alin Jerpelea
parent 7e3c341b15
commit 7758eb8658
21 changed files with 223 additions and 23 deletions

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_ARM_INCLUDE_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x ## l
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## ul
#define UINT64_C(x) x ## ull
#endif /* __ARCH_AVR_INCLUDE_AVR_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_AVR_INCLUDE_AVR32_INTTYPES_H */

View File

@ -244,6 +244,16 @@
# define SCNxMAX "llx"
# define SCNxPTR "x"
# define INT8_C(x) x
# define INT16_C(x) x
# define INT32_C(x) x ## l
# define INT64_C(x) x ## ll
# define UINT8_C(x) x
# define UINT16_C(x) x
# define UINT32_C(x) x ## ul
# define UINT64_C(x) x ## ull
#else
# define PRId8 "d"
@ -444,6 +454,16 @@
# define SCNxMAX "llx"
# define SCNxPTR "x"
# define INT8_C(x) x
# define INT16_C(x) x
# define INT32_C(x) x
# define INT64_C(x) x ## ll
# define UINT8_C(x) x
# define UINT16_C(x) x
# define UINT32_C(x) x ## u
# define UINT64_C(x) x ## ull
#endif
#endif /* __ARCH_HC_INCLUDE_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_MIPS_INCLUDE_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_MISOC_INCLUDE_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_OR1K_INCLUDE_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x ## l
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## ul
#define UINT64_C(x) x ## ull
#endif /* __ARCH_AVR_INCLUDE_M16C_INTTYPES_H */

View File

@ -237,4 +237,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_RENESAS_INCLUDE_RX65N_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_AVR_INCLUDE_SH1_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_RISCV_INCLUDE_INTTYPES_H */

View File

@ -244,6 +244,16 @@
# define SCNxMAX "llx"
# define SCNxPTR "llx"
# define INT8_C(x) x
# define INT16_C(x) x
# define INT32_C(x) x
# define INT64_C(x) x ## ll
# define UINT8_C(x) x
# define UINT16_C(x) x
# define UINT32_C(x) x ## u
# define UINT64_C(x) x ## ull
#else
# define PRId8 "d"
@ -444,6 +454,16 @@
# define SCNxMAX "llx"
# define SCNxPTR "x"
# define INT8_C(x) x
# define INT16_C(x) x
# define INT32_C(x) x
# define INT64_C(x) x ## ll
# define UINT8_C(x) x
# define UINT16_C(x) x
# define UINT32_C(x) x ## u
# define UINT64_C(x) x ## ull
#endif
#endif /* __ARCH_SIM_INCLUDE_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_X86_INCLUDE_I486_INTTYPES_H */

View File

@ -227,4 +227,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_X86_64_INCLUDE_INTEL64_INTTYPES_H */

View File

@ -242,4 +242,14 @@
#define SCNxMAX "llx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ull
#endif /* __ARCH_XTENSA_INCLUDE_INTTYPES_H */

View File

@ -209,4 +209,12 @@
#define SCNxMAX "x"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## u
#endif /* __ARCH_Z16_INCLUDE_INTTYPES_H */

View File

@ -211,6 +211,14 @@
# define SCNxMAX "lx"
# define SCNxPTR "hx"
# define INT8_C(x) x
# define INT16_C(x) x
# define INT32_C(x) x ## l
# define UINT8_C(x) x
# define UINT16_C(x) x
# define UINT32_C(x) x ## ul
#else
# define PRId8 "d"
@ -378,6 +386,13 @@
# define SCNxMAX "lx"
# define SCNxPTR "x"
# define INT8_C(x) x
# define INT16_C(x) x
# define INT32_C(x) x ## l
# define UINT8_C(x) x
# define UINT16_C(x) x
# define UINT32_C(x) x ## ul
#endif
#endif /* __ARCH_Z80_INCLUDE_EZ80_INTTYPES_H */

View File

@ -209,4 +209,12 @@
#define SCNxMAX "lx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x ## l
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## ul
#endif /* __ARCH_Z80_INCLUDE_Z180_INTTYPES_H */

View File

@ -209,4 +209,12 @@
#define SCNxMAX "lx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x ## l
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## ul
#endif /* __ARCH_Z80_INCLUDE_Z8_INTTYPES_H */

View File

@ -209,4 +209,12 @@
#define SCNxMAX "lx"
#define SCNxPTR "x"
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x ## l
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## ul
#endif /* __ARCH_Z80_INCLUDE_Z80_INTTYPES_H */

View File

@ -47,6 +47,7 @@
#else
# include <nuttx/compiler.h>
# include <arch/types.h>
# include <arch/inttypes.h>
# include <limits.h>
/****************************************************************************
@ -145,36 +146,18 @@
# define UINTMAX_MIN UINT64_MIN
# define UINTMAX_MAX UINT64_MAX
# define INTMAX_C(x) INT64_C(x)
# define UINTMAX_C(x) UINT64_C(x)
#else
# define INTMAX_MIN INT32_MIN
# define INTMAX_MAX INT32_MAX
# define UINTMAX_MIN UINT32_MIN
# define UINTMAX_MAX UINT32_MAX
#endif
/* Macros for minimum-width integer constant expressions */
#if 0 /* REVISIT: Depends on architecture specific implementation */
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x ## l
#define INT64_C(x) x ## ll
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## ul
#define UINT64_C(x) x ## ull
#endif
/* Macros for greatest-width integer constant expressions */
#ifdef CONFIG_HAVE_LONG_LONG
# define INTMAX_C(x) x ## ll
# define UINTMAX_C(x) x ## ull
#else
# define INTMAX_C(x) x ## l
# define UINTMAX_C(x) x ## ul
# define INTMAX_C(x) INT32_C(x)
# define UINTMAX_C(x) UINT32_C(x)
#endif
/* Limits of Other Integer Types */