From ac4e082d8a8502f47d351d614c37691614e0922e Mon Sep 17 00:00:00 2001 From: fdai7930 Date: Fri, 9 Feb 2024 12:39:52 +0100 Subject: [PATCH] Refactoring: remove _using from all multiplication fonctions name --- src/multiplication.c | 12 ++++++------ src/multiplication.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/multiplication.c b/src/multiplication.c index 133092c..a1d059f 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -47,7 +47,7 @@ int multi_string(const char* str, int factor) { -int multi_using_two_comp(int num2, int num3) { +int multi_two_comp(int num2, int num3) { int result = 0; while (num2 != 0) { if (num2 & 1) { @@ -63,7 +63,7 @@ int multi_by_even(int num, int factor) { return (num >> 1) << (factor + 1); } -int multi_using_lookup_table(int num1, int num2) { +int multi_lookup_table(int num1, int num2) { int lookup_table[10][10] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, @@ -79,7 +79,7 @@ int multi_using_lookup_table(int num1, int num2) { return lookup_table[num1][num2]; } -int multi_using_logical_op(int num1, int num2) { +int multi_logical_op(int num1, int num2) { int result = 0; while (num2) { if (num2 & 1) { @@ -99,7 +99,7 @@ int multi_by_prime(int num, int prime) { return num * (prime - 2) + num; } -int multi_using_increment(int num1, int num2) { +int multi_increment(int num1, int num2) { int result = 0; for (int i = 0; i < num2; ++i) { result += num1; @@ -119,7 +119,7 @@ int multi_by_odd(int num, int factor) { return result; } -int multi_using_binary_enumeration(int num1, int num2) { +int multi_binary_enumeration(int num1, int num2) { int result = 0; while (num1 && num2) { if (num2 & 1) { @@ -131,7 +131,7 @@ int multi_using_binary_enumeration(int num1, int num2) { return result; } -int multi_using_differences(int num1, int num2) { +int multi_differences(int num1, int num2) { int difference = (num1 > num2) ? num1 - num2 : num2 - num1; int sum = (num1 > num2) ? num1 + num2 : num2 + num1; return (sum - difference) * difference / 4; diff --git a/src/multiplication.h b/src/multiplication.h index 1618293..f8ba2d6 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -10,17 +10,17 @@ float multi_by_percentage(float num, float percentage); int multi_by_random(int num); int multi_string(const char* str, int factor); -int multi_using_two_comp(int num2, int num3); +int multi_two_comp(int num2, int num3); int multi_by_even(int num, int factor); -int multi_using_lookup_table(int num1, int num2); -int multi_using_logical_op(int num1, int num2); +int multi_lookup_table(int num1, int num2); +int multi_logical_op(int num1, int num2); int multi_modulo(int num1, int num2, int modulo); int multi_by_prime(int num, int prime); -int multi_using_increment(int num1, int num2); +int multi_increment(int num1, int num2); int multi_by_prime_and_its_square(int num, int prime); int multi_by_odd(int num, int factor); -int multi_using_binary_enumeration(int num1, int num2); -int multi_using_differences(int num1, int num2); +int multi_binary_enumeration(int num1, int num2); +int multi_differences(int num1, int num2); int multi_recursive_optimized(int num1, int num2); int multi_octal_numbers(int num1, int num2); int multi_hex_numbers(int num1, int num2);