Merge pull request #485 from devnexen/builtin_overflow_sig_fix

fix spurious build warning with overflow builtins
This commit is contained in:
Daan 2021-11-14 14:47:38 -08:00 committed by GitHub
commit 9c9c3a0311
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,11 +255,11 @@ static inline bool mi_malloc_satisfies_alignment(size_t alignment, size_t size)
#endif #endif
static inline bool mi_mul_overflow(size_t count, size_t size, size_t* total) { static inline bool mi_mul_overflow(size_t count, size_t size, size_t* total) {
#if (SIZE_MAX == ULONG_MAX) #if (SIZE_MAX == ULONG_MAX)
return __builtin_umull_overflow(count, size, total); return __builtin_umull_overflow(count, size, (unsigned long *)total);
#elif (SIZE_MAX == UINT_MAX) #elif (SIZE_MAX == UINT_MAX)
return __builtin_umul_overflow(count, size, total); return __builtin_umul_overflow(count, size, (unsigned int *)total);
#else #else
return __builtin_umulll_overflow(count, size, total); return __builtin_umulll_overflow(count, size, (unsigned long long *)total);
#endif #endif
} }
#else /* __builtin_umul_overflow is unavailable */ #else /* __builtin_umul_overflow is unavailable */