From 038616c901dae4f76063b36672bd6ec85e057e42 Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Wed, 12 Jan 2022 10:11:50 -0500 Subject: [PATCH] Try rearranging the order Maybe this will help me understand where the problem lies. --- src/core/include/units/magnitude.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/include/units/magnitude.h b/src/core/include/units/magnitude.h index c9013bd1..58ae46df 100644 --- a/src/core/include/units/magnitude.h +++ b/src/core/include/units/magnitude.h @@ -290,6 +290,16 @@ 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{}); + } + + // Case for when H2 has the smaller base. + if constexpr(H1.get_base() > H2.get_base()){ + return magnitude

{} * (magnitude{} * magnitude{}); + } + // "Same leading base" case. if constexpr (H1.get_base() == H2.get_base()) { constexpr auto partial_product = magnitude{} * magnitude{}; @@ -306,16 +316,6 @@ constexpr auto operator*(magnitude, magnitude) { return magnitude{} * partial_product; } } - - // Case for when H1 has the smaller base. - if constexpr(H1.get_base() < H2.get_base()){ - return magnitude

{} * (magnitude{} * magnitude{}); - } - - // Case for when H2 has the smaller base. - if constexpr(H1.get_base() > H2.get_base()){ - return magnitude

{} * (magnitude{} * magnitude{}); - } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////