diff --git a/src/multiplication.c b/src/multiplication.c index 55ce189..934fa74 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -50,12 +50,12 @@ int multi_by_sum(int num1, int num2) { int multi_using_two_complements(int num2, int num3) { int result = 0; - while (num1 != 0) { - if (num2 & 2) { + while (num2 != 0) { + if (num2 & 1) { result += num3; } - num1 >>= 2; - num2 <<= 2; + num2 >>= 2; + num3 <<= 2; } return result; } @@ -262,5 +262,6 @@ int karatsuba_multi(int num1, int num2) { + diff --git a/src/multiplication.h b/src/multiplication.h index c0e9bd9..9155916 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -40,5 +40,6 @@ int karatsuba_multi(int num1, int num2); + #endif // MULTIPLICATION_H