aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/nums.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-28 15:31:53 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-28 15:31:53 -0400
commitca76fb335ae7b3f820beeeed5667950e7489711e (patch)
treee0ef48cce92aeeb92241ef98c65bf3af84c05ca4 /src/stdlib/nums.h
parent4de0fee8f694503b453e04084caaab55f8670b6c (diff)
Add compiler guards for GCC directives
Diffstat (limited to 'src/stdlib/nums.h')
-rw-r--r--src/stdlib/nums.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/stdlib/nums.h b/src/stdlib/nums.h
index 3f0cccc8..f3de9dc5 100644
--- a/src/stdlib/nums.h
+++ b/src/stdlib/nums.h
@@ -36,8 +36,10 @@ MACROLIKE CONSTFUNC double Num$clamped(double x, double low, double high) {
return (x <= low) ? low : (x >= high ? high : x);
}
MACROLIKE CONSTFUNC double Num$from_num32(Num32_t n) { return (double)n; }
+#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
MACROLIKE CONSTFUNC double Num$from_int(Int_t i, bool truncate) {
if likely (i.small & 0x1) {
double ret = (double)(i.small >> 2);
@@ -55,7 +57,9 @@ MACROLIKE CONSTFUNC double Num$from_int(Int_t i, bool truncate) {
return ret;
}
}
+#ifdef __GNUC__
#pragma GCC diagnostic pop
+#endif
MACROLIKE CONSTFUNC double Num$from_int64(Int64_t i, bool truncate) {
double n = (double)i;
if unlikely (!truncate && (Int64_t)n != i)
@@ -88,8 +92,10 @@ MACROLIKE CONSTFUNC float Num32$clamped(float x, float low, float high) {
return (x <= low) ? low : (x >= high ? high : x);
}
MACROLIKE CONSTFUNC float Num32$from_num(Num_t n) { return (float)n; }
+#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
MACROLIKE CONSTFUNC float Num32$from_int(Int_t i, bool truncate) {
if likely (i.small & 0x1) {
float ret = (float)(i.small >> 2);
@@ -107,7 +113,9 @@ MACROLIKE CONSTFUNC float Num32$from_int(Int_t i, bool truncate) {
return ret;
}
}
+#ifdef __GNUC__
#pragma GCC diagnostic pop
+#endif
MACROLIKE CONSTFUNC float Num32$from_int64(Int64_t i, bool truncate) {
float n = (float)i;
if unlikely (!truncate && (Int64_t)n != i)