From 21aa828a08693f8d2ae9fe552a3324ce726ebd82 Mon Sep 17 00:00:00 2001 From: Zak Strange Date: Wed, 17 Jul 2019 14:48:59 -0700 Subject: [PATCH] Fixed issue related to unsigned/signed-ness of HMM_Power (#102) * Fixed issue related to unsigned/signed-ness of HMM_Power * Fixes missing braces around initializer warning with -Weverything with GCC. --- HandmadeMath.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/HandmadeMath.h b/HandmadeMath.h index de651e1..a0c3504 100644 --- a/HandmadeMath.h +++ b/HandmadeMath.h @@ -129,6 +129,11 @@ #pragma GCC diagnostic ignored "-Wgnu-anonymous-struct" #endif +#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 8) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-braces" +#endif + #ifdef __cplusplus extern "C" { @@ -2169,6 +2174,10 @@ HMM_INLINE hmm_bool operator!=(hmm_vec4 Left, hmm_vec4 Right) #pragma GCC diagnostic pop #endif +#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 8) +#pragma GCC diagnostic pop +#endif + #endif /* HANDMADE_MATH_H */ #ifdef HANDMADE_MATH_IMPLEMENTATION @@ -2177,7 +2186,7 @@ float HMM_Power(float Base, int Exponent) { float Result = 1.0f; float Mul = Exponent < 0 ? 1.f / Base : Base; - unsigned int X = Exponent < 0 ? -Exponent : Exponent; + int X = Exponent < 0 ? -Exponent : Exponent; while (X) { if (X & 1)