Browse Source

replaced num1 with num2 in multi_using_two_complements

remotes/origin/multiplication
fdai7930 11 months ago
parent
commit
a81f436fea
  1. 9
      src/multiplication.c
  2. 1
      src/multiplication.h

9
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;
}
@ -264,3 +264,4 @@ int karatsuba_multi(int num1, int num2) {

1
src/multiplication.h

@ -40,5 +40,6 @@ int karatsuba_multi(int num1, int num2);
#endif // MULTIPLICATION_H
Loading…
Cancel
Save