This patch adds new function that compute the greatest common
divisor of 64 bits, also changes the original 32 bits function
to call this new 64-bit version.
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
* gcd(a, b) = gcd(b, a mod b)
*
*/
-static inline uint32_t
-rte_get_gcd(uint32_t a, uint32_t b)
+static inline uint64_t
+rte_get_gcd64(uint64_t a, uint64_t b)
{
- uint32_t c;
+ uint64_t c;
if (a == 0)
return b;
return a;
}
+/*
+ * 32-bit version of Greatest Common Divisor (GCD).
+ */
+static inline uint32_t
+rte_get_gcd(uint32_t a, uint32_t b)
+{
+ return rte_get_gcd64(a, b);
+}
+
/*
* Compute the Lowest Common Denominator (LCD) of two numbers.
* This implementation computes GCD first: