diff options
Diffstat (limited to 'src/vppinfra/types.h')
-rw-r--r-- | src/vppinfra/types.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/vppinfra/types.h b/src/vppinfra/types.h index 42217968dcc..ad85af35ac9 100644 --- a/src/vppinfra/types.h +++ b/src/vppinfra/types.h @@ -131,6 +131,9 @@ typedef u32 clib_address_t; #define CLIB_U32_MAX __UINT32_MAX__ #define CLIB_U64_MAX __UINT64_MAX__ +#define CLIB_F64_MAX __DBL_MAX__ +#define CLIB_F32_MAX __FLT_MAX__ + #if clib_address_bits == 64 #define CLIB_WORD_MAX CLIB_I64_MAX #define CLIB_UWORD_MAX CLIB_U64_MAX @@ -197,11 +200,17 @@ typedef word wordu __attribute__ ((aligned (1), __may_alias__)); typedef uword uwordu __attribute__ ((aligned (1), __may_alias__)); #define foreach_int(__var, ...) \ - for (int __int_array[] = { __VA_ARGS__ }, *__int_ptr = __int_array, \ + for (int __int_array[] = { __VA_ARGS__, 0 }, *__int_ptr = __int_array, \ __var = *__int_ptr; \ - __int_ptr - ARRAY_LEN (__int_array) < __int_array; \ + __int_ptr - (ARRAY_LEN (__int_array) - 1) < __int_array; \ __var = *++__int_ptr) +#define foreach_pointer(__var, ...) \ + for (void *__ptr_array[] = { __VA_ARGS__, 0 }, **__ptr_ptr = __ptr_array, \ + *__var = *__ptr_ptr; \ + __ptr_ptr - (ARRAY_LEN (__ptr_array) - 1) < __ptr_array; \ + __var = *++__ptr_ptr) + #endif /* included_clib_types_h */ /* |