mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
Unify "H1 base smaller" test cases
This might actually fix the error!
This commit is contained in:
@@ -287,13 +287,15 @@ constexpr auto operator*(Magnitude auto m, magnitude<>) { return m; }
|
||||
// Recursive case for the product of any two non-identity Magnitudes.
|
||||
template<BasePower auto H1, BasePower auto... T1, BasePower auto H2, BasePower auto... T2>
|
||||
constexpr auto operator*(magnitude<H1, T1...>, magnitude<H2, T2...>) {
|
||||
// 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<H1, H2, T2...>{}; }
|
||||
|
||||
// Case for when H1 has the smaller base.
|
||||
if constexpr(H1.get_base() < H2.get_base()){
|
||||
if constexpr (sizeof...(T1) == 0) {
|
||||
// Shortcut for the "pure prepend" case, which makes it easier to implement some of the other cases.
|
||||
return magnitude<H1, H2, T2...>{};
|
||||
} else {
|
||||
return magnitude<H1>{} * (magnitude<T1...>{} * magnitude<H2, T2...>{});
|
||||
}
|
||||
}
|
||||
|
||||
// Case for when H2 has the smaller base.
|
||||
if constexpr(H1.get_base() > H2.get_base()){
|
||||
|
Reference in New Issue
Block a user