Tue, 07 Feb 2023 20:08:08 +0100
fix wrong types for umul overflow builtins
src/cx/utils.h | file | annotate | diff | comparison | revisions |
--- a/src/cx/utils.h Tue Feb 07 20:06:33 2023 +0100 +++ b/src/cx/utils.h Tue Feb 07 20:08:08 2023 +0100 @@ -58,20 +58,6 @@ #if __WORDSIZE == 32 /** - * Alias for \c __builtin_umul_overflow. - * - * Performs a multiplication of size_t values and checks for overflow. - * - * @param a first operand - * @param b second operand - * @param result a pointer to a size_t, where the result should - * be stored - * @return zero, if no overflow occurred and the result is correct, non-zero - * otherwise - */ -#define cx_szmul(a, b, result) __builtin_umul_overflow(a, b, result) -#else // __WORDSIZE != 32 -/** * Alias for \c __builtin_umull_overflow. * * Performs a multiplication of size_t values and checks for overflow. @@ -84,6 +70,20 @@ * otherwise */ #define cx_szmul(a, b, result) __builtin_umull_overflow(a, b, result) +#else // __WORDSIZE != 32 +/** + * Alias for \c __builtin_umulll_overflow. + * + * Performs a multiplication of size_t values and checks for overflow. + * + * @param a first operand + * @param b second operand + * @param result a pointer to a size_t, where the result should + * be stored + * @return zero, if no overflow occurred and the result is correct, non-zero + * otherwise + */ +#define cx_szmul(a, b, result) __builtin_umulll_overflow(a, b, result) #endif // __WORDSIZE #else // no GNUC or clang bultin