From 8a6da4d6210192ada4a26ddd397c00d78b08dfcc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 26 Sep 2024 13:48:58 -0400 Subject: Rename our lerp() to flerp(); call where MSVC balks at std::lerp(). Now the lerp() in global namespace is std::lerp(), but it remains true that for some calls to std::lerp(), MSVC issues fatal argument conversion warnings. In those places, call flerp() (our historic lerp()) instead. --- indra/llmath/llmath.h | 8 ++++---- indra/llmath/llvolume.cpp | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 75284ef57e..1d6d986207 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -358,11 +358,11 @@ inline F32 snap_to_sig_figs(F32 foo, S32 sig_figs) return new_foo; } +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) +// as this function, in some cases MSVC likes this one better: some calls to +// std::lerp() produce fatal argument conversion warnings. +inline F32 flerp(F32 a, F32 b, F32 u) { return a + ((b - a) * u); } diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 700e61467b..275e5bcb43 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -1294,9 +1294,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en c = cos(ang)*lerp(radius_start, radius_end, t); - pt->mPos.set(0 + lerp(0,params.getShear().mV[0],s) - + lerp(-skew ,skew, t) * 0.5f, - c + lerp(0,params.getShear().mV[1],s), + pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s) + + flerp(-skew ,skew, t) * 0.5f, + c + flerp(0,params.getShear().mV[1],s), s); pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t), hole_y * lerp(taper_y_begin, taper_y_end, t), @@ -1327,9 +1327,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en c = cos(ang)*lerp(radius_start, radius_end, t); s = sin(ang)*lerp(radius_start, radius_end, t); - pt->mPos.set(0 + lerp(0,params.getShear().mV[0],s) - + lerp(-skew ,skew, t) * 0.5f, - c + lerp(0,params.getShear().mV[1],s), + pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s) + + flerp(-skew ,skew, t) * 0.5f, + c + flerp(0,params.getShear().mV[1],s), s); pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t), @@ -1354,9 +1354,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en c = cos(ang)*lerp(radius_start, radius_end, t); s = sin(ang)*lerp(radius_start, radius_end, t); - pt->mPos.set(0 + lerp(0,params.getShear().mV[0],s) - + lerp(-skew ,skew, t) * 0.5f, - c + lerp(0,params.getShear().mV[1],s), + pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s) + + flerp(-skew ,skew, t) * 0.5f, + c + flerp(0,params.getShear().mV[1],s), s); pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t), hole_y * lerp(taper_y_begin, taper_y_end, t), @@ -1494,8 +1494,8 @@ bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split, for (S32 i=0;i