-/* compile-time assertion that 'x' and 'y' are equivalent types */
-#define __OS_TYPE_CHECK(x, y) do { \
- _Static_assert(__builtin_types_compatible_p(typeof(x),typeof(y)), \
- "overflow arithmetic: incompatible types"); \
-} while (0)
-
-#define __os_add_overflow_func(T,U,V) _Generic((T), \
- unsigned: __builtin_uadd_overflow, \
- unsigned long: __builtin_uaddl_overflow, \
- unsigned long long: __builtin_uaddll_overflow, \
- int: __builtin_sadd_overflow, \
- long: __builtin_saddl_overflow, \
- long long: __builtin_saddll_overflow \
- )(T,U,V)
-
-#define __os_sub_overflow_func(T,U,V) _Generic((T), \
- unsigned: __builtin_usub_overflow, \
- unsigned long: __builtin_usubl_overflow, \
- unsigned long long: __builtin_usubll_overflow, \
- int: __builtin_ssub_overflow, \
- long: __builtin_ssubl_overflow, \
- long long: __builtin_ssubll_overflow \
- )(T,U,V)
-
-#define __os_mul_overflow_func(T,U,V) _Generic((T), \
- unsigned: __builtin_umul_overflow, \
- unsigned long: __builtin_umull_overflow, \
- unsigned long long: __builtin_umulll_overflow, \
- int: __builtin_smul_overflow, \
- long: __builtin_smull_overflow, \
- long long: __builtin_smulll_overflow \
- )(T,U,V)
-
-int __header_always_inline __attribute__((__warn_unused_result__))
-__os_warn_unused(const int x)