Tue, 07 Feb 2023 20:08:08 +0100
fix wrong types for umul overflow builtins
src/cx/utils.h | file | annotate | diff | comparison | revisions |
1.1 --- a/src/cx/utils.h Tue Feb 07 20:06:33 2023 +0100 1.2 +++ b/src/cx/utils.h Tue Feb 07 20:08:08 2023 +0100 1.3 @@ -58,20 +58,6 @@ 1.4 1.5 #if __WORDSIZE == 32 1.6 /** 1.7 - * Alias for \c __builtin_umul_overflow. 1.8 - * 1.9 - * Performs a multiplication of size_t values and checks for overflow. 1.10 - * 1.11 - * @param a first operand 1.12 - * @param b second operand 1.13 - * @param result a pointer to a size_t, where the result should 1.14 - * be stored 1.15 - * @return zero, if no overflow occurred and the result is correct, non-zero 1.16 - * otherwise 1.17 - */ 1.18 -#define cx_szmul(a, b, result) __builtin_umul_overflow(a, b, result) 1.19 -#else // __WORDSIZE != 32 1.20 -/** 1.21 * Alias for \c __builtin_umull_overflow. 1.22 * 1.23 * Performs a multiplication of size_t values and checks for overflow. 1.24 @@ -84,6 +70,20 @@ 1.25 * otherwise 1.26 */ 1.27 #define cx_szmul(a, b, result) __builtin_umull_overflow(a, b, result) 1.28 +#else // __WORDSIZE != 32 1.29 +/** 1.30 + * Alias for \c __builtin_umulll_overflow. 1.31 + * 1.32 + * Performs a multiplication of size_t values and checks for overflow. 1.33 + * 1.34 + * @param a first operand 1.35 + * @param b second operand 1.36 + * @param result a pointer to a size_t, where the result should 1.37 + * be stored 1.38 + * @return zero, if no overflow occurred and the result is correct, non-zero 1.39 + * otherwise 1.40 + */ 1.41 +#define cx_szmul(a, b, result) __builtin_umulll_overflow(a, b, result) 1.42 #endif // __WORDSIZE 1.43 1.44 #else // no GNUC or clang bultin