From d7f6b96e36c3cadb7a2731c6417709ee9668f2d7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 26 Sep 2024 12:35:27 -0400 Subject: Reinstate our lerp() function, avoid "math.h" header. For reasons that remain unclear, MSVC likes our lerp() function better than its own std::lerp() function: publishing the latter into the global namespace, instead of defining our own, produces fatal argument conversion warnings. "math.h" publishes all of into the global namespace, which causes a GCC conflict between std::lerp() and our lerp() function. Including instead leaves std::lerp() in the std namespace, eliminating the conflict. --- indra/llmath/llmath.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/llmath/llmath.h') diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 09b685a68b..75284ef57e 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -358,9 +358,14 @@ inline F32 snap_to_sig_figs(F32 foo, S32 sig_figs) return new_foo; } -// We used to define a simple lerp(F32, F32, F32) that probably predated -// std::lerp(). By now, do we need our own definition any longer? -using std::lerp; +// Even though there's now a std::lerp() function that appears to do the same +// as this function, for some reason MSVC likes this one better. Publishing +// std::lerp() into the global namespace instead of defining this function +// results in fatal argument conversion warnings. +inline F32 lerp(F32 a, F32 b, F32 u) +{ + return a + ((b - a) * u); +} inline F32 lerp2d(F32 x00, F32 x01, F32 x10, F32 x11, F32 u, F32 v) { -- cgit v1.2.3