From 71ee57bc923bcbbcc7350d9f74bf68d5c54239de Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 26 Jul 2023 19:33:43 +0200 Subject: [PATCH] linmath: Unroll LVecBase4 less-than operator implementation --- panda/src/linmath/lvecBase4_src.I | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/panda/src/linmath/lvecBase4_src.I b/panda/src/linmath/lvecBase4_src.I index 4c861b2ab9..08ecb90281 100644 --- a/panda/src/linmath/lvecBase4_src.I +++ b/panda/src/linmath/lvecBase4_src.I @@ -428,7 +428,34 @@ project(const FLOATNAME(LVecBase4) &onto) const { INLINE_LINMATH bool FLOATNAME(LVecBase4):: operator < (const FLOATNAME(LVecBase4) &other) const { TAU_PROFILE("bool LVecBase4::operator <(const LVecBase4 &)", " ", TAU_USER); - return (compare_to(other) < 0); +#ifdef FLOATTYPE_IS_INT + if (_v(0) != other._v(0)) { + return _v(0) < other._v(0); + } + if (_v(1) != other._v(1)) { + return _v(1) < other._v(1); + } + if (_v(2) != other._v(2)) { + return _v(2) < other._v(2); + } + if (_v(3) != other._v(3)) { + return _v(3) < other._v(3); + } +#else + if (!IS_THRESHOLD_COMPEQ(_v(0), other._v(0), NEARLY_ZERO(FLOATTYPE))) { + return _v(0) < other._v(0); + } + if (!IS_THRESHOLD_COMPEQ(_v(1), other._v(1), NEARLY_ZERO(FLOATTYPE))) { + return _v(1) < other._v(1); + } + if (!IS_THRESHOLD_COMPEQ(_v(2), other._v(2), NEARLY_ZERO(FLOATTYPE))) { + return _v(2) < other._v(2); + } + if (!IS_THRESHOLD_COMPEQ(_v(3), other._v(3), NEARLY_ZERO(FLOATTYPE))) { + return _v(3) < other._v(3); + } +#endif + return false; } /**