diff --git a/ttmath/ttmathuint.h b/ttmath/ttmathuint.h index 43d68c1..7c5341a 100644 --- a/ttmath/ttmathuint.h +++ b/ttmath/ttmathuint.h @@ -955,17 +955,20 @@ public: switch( algorithm ) { case 1: - return Mul1Big(ss2, result); + Mul1Big(ss2, result); + break; case 2: - return Mul2Big(ss2, result); + Mul2Big(ss2, result); + break; case 3: - return Mul3Big(ss2, result); + Mul3Big(ss2, result); + break; case 100: default: - return MulFastestBig(ss2, result); + MulFastestBig(ss2, result); } } @@ -1501,7 +1504,10 @@ public: void MulFastestBig(const UInt & ss2, UInt & result) { if( value_size < TTMATH_USE_KARATSUBA_MULTIPLICATION_FROM_SIZE ) - return Mul2Big(ss2, result); + { + Mul2Big(ss2, result); + return; + } uint x1size = value_size, x2size = value_size; uint x1start = 0, x2start = 0; @@ -1523,9 +1529,12 @@ public: uint distancex2 = x2size - x2start; if( distancex1 < 3 || distancex2 < 3 ) + { // either 'this' or 'ss2' have only 2 (or 1) items different from zero (side by side) // (this condition in the future can be improved) - return Mul2Big3(table, ss2.table, result, x1start, x1size, x2start, x2size); + Mul2Big3(table, ss2.table, result, x1start, x1size, x2start, x2size); + return; + } // Karatsuba multiplication