# HG changeset patch # User Mike Becker # Date 1675802275 -3600 # Node ID 19d1a8422f6e54bc8565c00d63c1186b2fe58dae # Parent 77021e06b1a84fcebe3bac5ed57eb4489d60428c fix last change of mul overflow builtin breaking non-windows compilations now we use the generic builtin and leave the type resolution to the compiler diff -r 77021e06b1a8 -r 19d1a8422f6e src/cx/common.h --- a/src/cx/common.h Tue Feb 07 20:08:45 2023 +0100 +++ b/src/cx/common.h Tue Feb 07 21:37:55 2023 +0100 @@ -105,16 +105,11 @@ ); #ifdef _WIN32 + #ifdef __MINGW32__ #include #endif // __MINGW32__ -#ifndef __WORDSIZE -#ifdef _WIN64 -#define __WORDSIZE 64 -#else -#define __WORDSIZE 32 -#endif // _WIN64 -#endif // __WORDSIZE + #else // !_WIN32 #include diff -r 77021e06b1a8 -r 19d1a8422f6e src/cx/utils.h --- a/src/cx/utils.h Tue Feb 07 20:08:45 2023 +0100 +++ b/src/cx/utils.h Tue Feb 07 21:37:55 2023 +0100 @@ -56,9 +56,8 @@ #if (__GNUC__ >= 5 || defined(__clang__)) && !defined(CX_NO_SZMUL_BUILTIN) #define CX_SZMUL_BUILTIN -#if __WORDSIZE == 32 /** - * Alias for \c __builtin_umull_overflow. + * Alias for \c __builtin_mul_overflow. * * Performs a multiplication of size_t values and checks for overflow. * @@ -69,22 +68,7 @@ * @return zero, if no overflow occurred and the result is correct, non-zero * 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 +#define cx_szmul(a, b, result) __builtin_mul_overflow(a, b, result) #else // no GNUC or clang bultin diff -r 77021e06b1a8 -r 19d1a8422f6e test/selftest.cpp --- a/test/selftest.cpp Tue Feb 07 20:08:45 2023 +0100 +++ b/test/selftest.cpp Tue Feb 07 21:37:55 2023 +0100 @@ -37,7 +37,3 @@ EXPECT_GE(UCX_VERSION_MAJOR, 3); EXPECT_GE(UCX_VERSION, 3 << 16); } - -TEST(SelfTest, CommonDefinitions) { - EXPECT_EQ(__WORDSIZE, 8 * sizeof(void*)); -}