DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Xueming Li <xuemingl@nvidia.com>, dev@dpdk.org
Cc: Thomas Monjalon <thomas@monjalon.net>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Jasvinder Singh <jasvinder.singh@intel.com>
Subject: Re: [dpdk-dev] [PATCH v1] sched: adds function to get 64 bits greatest common divisor
Date: Wed, 22 Sep 2021 18:09:50 +0100	[thread overview]
Message-ID: <32dc9e20-86dc-a0a6-74a2-9894cb680170@redhat.com> (raw)
In-Reply-To: <20210915102610.83105-1-xuemingl@nvidia.com>

On 15/09/2021 11:26, Xueming Li wrote:
> 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.
> 

Can you say why it is needed? It's unused apart from being called for 
the original 32 bit version.

> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
> v1: add 64 bits version and make 32 bits api call it
> 
>   lib/sched/rte_sched_common.h | 19 ++++++++++++++++---
>   1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/sched/rte_sched_common.h b/lib/sched/rte_sched_common.h
> index 96706df7bd..1056543a84 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,19 @@ rte_get_gcd(uint32_t a, uint32_t b)
>   	return a;
>   }
>   
> +/*
> + * Compute the Greatest Common Divisor (GCD) of two u32 numbers.
> + * This implementation uses Euclid's algorithm:
> + *    gcd(a, 0) = a
> + *    gcd(a, b) = gcd(b, a mod b)
> + *
> + */

I would probably not describe the algorithm here as it is not 
implemented in this function.

> +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:
> 


  reply	other threads:[~2021-09-22 17:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23  8:15 [dpdk-dev] [PATCH] sched: support " 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 [this message]
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       ` [dpdk-dev] [PATCH v2 1/2] " Xueming Li
2021-09-23  9:53         ` 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=32dc9e20-86dc-a0a6-74a2-9894cb680170@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.com \
    --cc=thomas@monjalon.net \
    --cc=xuemingl@nvidia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).