From: Xueming Li Date: Thu, 23 Sep 2021 08:11:21 +0000 (+0800) Subject: sched: get 64-bit greatest common divisor X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=eb5636e879a568a323cbed4c356162011e7312be;p=dpdk.git sched: get 64-bit greatest common divisor 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 Acked-by: Kevin Traynor --- diff --git a/lib/sched/rte_sched_common.h b/lib/sched/rte_sched_common.h index 96706df7bd..e4cbbd9077 100644 --- a/lib/sched/rte_sched_common.h +++ b/lib/sched/rte_sched_common.h @@ -51,10 +51,10 @@ rte_min_pos_4_u16(uint16_t *x) * 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; @@ -76,6 +76,15 @@ rte_get_gcd(uint32_t a, uint32_t 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: