X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Ftypes.h;h=ad85af35ac94b2ce555830f26fccd57b70d5590c;hb=38c619115;hp=42217968dccb22dd4b6b7ee36e25a31b11b7a6b0;hpb=d3ef00098cd27e01bb24db15e3440fabbc025aa8;p=vpp.git 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 */ /*