@@ -223,21 +223,24 @@ constexpr auto multiply(T a , T b) {
223223 };
224224
225225 auto halver = [](auto count) {
226- return count >> 1 ;
226+ return count << 1 ;
227227 };
228228
229229 constexpr auto numBits = sizeof (T) * 8 ;
230+ constexpr auto msb = 1 << (numBits - 1 );
230231 return associativeOperatorIterated_regressive (
231232 a, // base
232233 0 , // neutral
233234 b, // count
234- 1 , // forSquaring, pretty sure this is where i am not understanding
235+ 0 , // forSquaring, pretty sure this is where i am not understanding
235236 operation, // operation
236237 numBits, // log2Count
237238 halver // halver
238239 );
239240}
240241
242+ // static_assert(multiply(3, 4) == 12, "multiply failed");
243+
241244template <int ActualBits, int NB, typename T>
242245constexpr auto multiplication_OverflowUnsafe_SpecificBitCount (
243246 SWAR<NB, T> multiplicand, SWAR<NB, T> multiplier
@@ -267,7 +270,7 @@ constexpr auto multiplication_OverflowUnsafe_SpecificBitCount(
267270}
268271
269272template <int ActualBits, int NB, typename T>
270- constexpr auto expo_OverflowUnsafe_SpecificBitCount (
273+ constexpr auto exponentiation_OverflowUnsafe_SpecificBitCount (
271274 SWAR<NB, T> x,
272275 SWAR<NB, T> exponent
273276) {
@@ -339,12 +342,12 @@ constexpr auto multiplication_OverflowUnsafe(
339342}
340343
341344template <int NB, typename T>
342- constexpr auto expo_OverflowUnsafe (
345+ constexpr auto exponentiation_OverflowUnsafe (
343346 SWAR<NB, T> base,
344347 SWAR<NB, T> exponent
345348) {
346349 return
347- expo_OverflowUnsafe_SpecificBitCount <NB>(
350+ exponentiation_OverflowUnsafe_SpecificBitCount <NB>(
348351 base, exponent
349352 );
350353}
0 commit comments