diff options
author | Damjan Marion <damarion@cisco.com> | 2022-04-06 12:01:47 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2022-04-06 12:08:40 +0200 |
commit | 6e061e784d85c8aedea8987c98c86ec7c1b84321 (patch) | |
tree | b31b8d2720a0b6c0a56fd9e1ef2aedf5c27c26f1 /src/vppinfra | |
parent | 3791a034d1a50607695b12b56396e480c439880e (diff) |
vppinfra: add MAX macros for clib types
Type: improvement
Change-Id: I1bca733d2a35733275efa46ee0a23bf572365c74
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r-- | src/vppinfra/types.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vppinfra/types.h b/src/vppinfra/types.h index e098db5fbaf..78418239cd5 100644 --- a/src/vppinfra/types.h +++ b/src/vppinfra/types.h @@ -125,6 +125,24 @@ typedef u64 clib_address_t; typedef u32 clib_address_t; #endif +#define CLIB_I8_MAX __INT8_MAX__ +#define CLIB_I16_MAX __INT16_MAX__ +#define CLIB_I32_MAX __INT32_MAX__ +#define CLIB_I64_MAX __INT64_MAX__ + +#define CLIB_U8_MAX __UINT8_MAX__ +#define CLIB_U16_MAX __UINT16_MAX__ +#define CLIB_U32_MAX __UINT32_MAX__ +#define CLIB_U64_MAX __UINT64_MAX__ + +#if clib_address_bits == 64 +#define CLIB_WORD_MAX CLIB_I64_MAX +#define CLIB_UWORD_MAX CLIB_U64_MAX +#else +#define CLIB_WORD_MAX CLIB_I32_MAX +#define CLIB_UWORD_MAX CLIB_U32_MAX +#endif + /* These are needed to convert between pointers and machine words. MIPS is currently the only machine that can have different sized pointers and machine words (but only when compiling with 64 bit |