From: Xueming Li <xuemingl@nvidia.com>
To: Matan Azrad <matan@nvidia.com>, <dev@dpdk.org>
Cc: <xuemingl@nvidia.com>, Kevin Traynor <ktraynor@redhat.com>,
<stable@dpdk.org>,
Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
Jasvinder Singh <jasvinder.singh@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/2] sched: adds function to get 64 bits greatest common divisor
Date: Thu, 23 Sep 2021 16:11:21 +0800 [thread overview]
Message-ID: <20210923081122.176735-2-xuemingl@nvidia.com> (raw)
In-Reply-To: <20210923081122.176735-1-xuemingl@nvidia.com>
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 bits version.
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Cc: stable@dpdk.org
---
lib/sched/rte_sched_common.h | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/sched/rte_sched_common.h b/lib/sched/rte_sched_common.h
index 96706df7bd..340a0df312 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;
}
+/*
+ * 32bit version of Compute the 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:
--
2.33.0
next prev parent reply other threads:[~2021-09-23 8:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 8:15 [dpdk-dev] [PATCH] sched: support 64 bits greatest common divisor Xueming Li
2021-09-15 10:26 ` [dpdk-dev] [PATCH v1] sched: adds function to get " Xueming Li
2021-09-22 17:09 ` Kevin Traynor
2021-09-23 5:34 ` Xueming(Steven) Li
2021-09-23 8:11 ` [dpdk-dev] [PATCH v2 0/2] " Xueming Li
2021-09-23 8:11 ` Xueming Li [this message]
2021-09-23 9:53 ` [dpdk-dev] [PATCH v2 1/2] " Kevin Traynor
2021-09-23 8:11 ` [dpdk-dev] [PATCH v2 2/2] vdpa/mlx5: fix large VM memory region registration Xueming Li
2021-09-27 15:26 ` [dpdk-dev] [PATCH v2 0/2] sched: adds function to get 64 bits greatest common divisor Thomas Monjalon
2021-09-28 5:47 ` Xueming(Steven) Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210923081122.176735-2-xuemingl@nvidia.com \
--to=xuemingl@nvidia.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=jasvinder.singh@intel.com \
--cc=ktraynor@redhat.com \
--cc=matan@nvidia.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.