From 1c70b187091b5a2d149ea663a1d1700e035281f9 Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Wed, 12 Jan 2022 10:47:59 -0500 Subject: [PATCH] Unify "H1 base smaller" test cases This might actually fix the error! --- src/core/include/units/magnitude.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/include/units/magnitude.h b/src/core/include/units/magnitude.h index 58ae46df..8e9c46ca 100644 --- a/src/core/include/units/magnitude.h +++ b/src/core/include/units/magnitude.h @@ -287,12 +287,14 @@ constexpr auto operator*(Magnitude auto m, magnitude<>) { return m; } // Recursive case for the product of any two non-identity Magnitudes. template constexpr auto operator*(magnitude, magnitude) { - // Shortcut for the "pure prepend" case, which makes it easier to implement some of the other cases. - if constexpr ((sizeof...(T1) == 0) && H1.get_base() < H2.get_base()) { return magnitude{}; } - // Case for when H1 has the smaller base. if constexpr(H1.get_base() < H2.get_base()){ - return magnitude

{} * (magnitude{} * magnitude{}); + if constexpr (sizeof...(T1) == 0) { + // Shortcut for the "pure prepend" case, which makes it easier to implement some of the other cases. + return magnitude{}; + } else { + return magnitude

{} * (magnitude{} * magnitude{}); + } } // Case for when H2 has the smaller base.