diff options
Diffstat (limited to 'include/util/util.h')
-rw-r--r-- | include/util/util.h | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/include/util/util.h b/include/util/util.h index 095f02a..a133067 100644 --- a/include/util/util.h +++ b/include/util/util.h @@ -18,34 +18,6 @@ #define container_of(ptr, type, member) \ ((type *)((char *)ptr - offsetof(type, member))) -#if defined(__GNUC__) || defined(__clang__) -#define UI_ADD_OV __builtin_uadd_overflow -#define UL_ADD_OV __builtin_uaddl_overflow -#define ULL_ADD_OV __builtin_uaddll_overflow - -#define UI_MUL_OV __builtin_umul_overflow -#define UL_MUL_OV __builtin_umull_overflow -#define ULL_MUL_OV __builtin_umulll_overflow -#else -#error Sorry, I do not know how to trap integer overflows with this compiler -#endif - -#if SIZEOF_SIZE_T <= SIZEOF_INT -#define SZ_ADD_OV UI_ADD_OV -#define SZ_MUL_OV UI_MUL_OV -#define PRI_SZ "%u" -#elif SIZEOF_SIZE_T == SIZEOF_LONG -#define SZ_ADD_OV UL_ADD_OV -#define SZ_MUL_OV UL_MUL_OV -#define PRI_SZ "%lu" -#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG -#define SZ_ADD_OV ULL_ADD_OV -#define SZ_MUL_OV ULL_MUL_OV -#define PRI_SZ "%llu" -#else -#error Cannot determine maximum value of size_t -#endif - /* Helper for allocating data structures with flexible array members. |