diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-07 03:21:58 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-07 03:21:58 -0400 |
| commit | 82f5f05bb9440b758ae5e4a7c168e36ecff06db5 (patch) | |
| tree | e9f997f469a1c26016ff2b58c716bfb643930272 /src/stdlib/nums.h | |
| parent | 6c3e2cdf12a09e0cfceb2032140ac7dfa222620b (diff) | |
Move clamped() and is_between() to proper functions (not just macros)
Diffstat (limited to 'src/stdlib/nums.h')
| -rw-r--r-- | src/stdlib/nums.h | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/stdlib/nums.h b/src/stdlib/nums.h index 84d87dd5..5871c904 100644 --- a/src/stdlib/nums.h +++ b/src/stdlib/nums.h @@ -32,12 +32,8 @@ CONSTFUNC bool Num$isnan(double n); double Num$nan(Text_t tag); CONSTFUNC double Num$mix(double amount, double x, double y); OptionalNum_t Num$parse(Text_t text); -MACROLIKE CONSTFUNC bool Num$is_between(const double x, const double low, const double high) { - return low <= x && x <= high; -} -MACROLIKE CONSTFUNC double Num$clamped(double x, double low, double high) { - return (x <= low) ? low : (x >= high ? high : x); -} +CONSTFUNC bool Num$is_between(const double x, const double low, const double high); +CONSTFUNC double Num$clamped(double x, double low, double high); MACROLIKE CONSTFUNC double Num$from_num32(Num32_t n) { return (double)n; } #ifdef __GNUC__ #pragma GCC diagnostic push @@ -91,12 +87,8 @@ CONSTFUNC bool Num32$isnan(float n); CONSTFUNC float Num32$mix(float amount, float x, float y); OptionalNum32_t Num32$parse(Text_t text); float Num32$nan(Text_t tag); -MACROLIKE CONSTFUNC bool Num32$is_between(const float x, const float low, const float high) { - return low <= x && x <= high; -} -MACROLIKE CONSTFUNC float Num32$clamped(float x, float low, float high) { - return (x <= low) ? low : (x >= high ? high : x); -} +CONSTFUNC bool Num32$is_between(const float x, const float low, const float high); +CONSTFUNC float Num32$clamped(float x, float low, float high); MACROLIKE CONSTFUNC float Num32$from_num(Num_t n) { return (float)n; } #ifdef __GNUC__ #pragma GCC diagnostic push |
