diff --git a/src/multiplication.c b/src/multiplication.c index 143fa25..3c5c479 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -60,5 +60,9 @@ int multiply_using_two_complements(int num1, int num2) { return result; } +int multiply_by_even(int num, int factor) { + return (num >> 1) << (factor + 1); +} + diff --git a/src/multiplication.h b/src/multiplication.h index dd99a1f..a3c42b1 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -11,6 +11,7 @@ int multiply_by_random(int num); int multiply_string(const char* str, int factor); int multiply_by_sum(int num1, int num2); int multiply_using_two_complements(int num1, int num2); +int multiply_by_even(int num, int factor); #endif // MULTIPLICATION_H