From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7AB91A0C45; Wed, 22 Sep 2021 19:09:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1849F411EC; Wed, 22 Sep 2021 19:09:57 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 299E7411A8 for ; Wed, 22 Sep 2021 19:09:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632330594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4/ZS+BgLkXIjhPXysCz/zxL+dwCaYiXpKP90ibz6DsA=; b=Xli2Tyu3B1jeF9uKnZKNfLmepGhwyudrRr3DXuwgfnG9uzX8QBvRVpZSWpee47KfH3eoI2 FEOu+5qyeij0GhO9ajrlclKVqFktcFI+g0EiWtOpSUaW8U35uBHaX/FbRDJONGPixZnxji 2cylWENFnjRzkESEHXVu+ucOraC4TxA= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-DJj6dKoCNAGO-l9Dja3ebg-1; Wed, 22 Sep 2021 13:09:53 -0400 X-MC-Unique: DJj6dKoCNAGO-l9Dja3ebg-1 Received: by mail-wr1-f72.google.com with SMTP id e1-20020adfa741000000b0015e424fdd01so2777580wrd.11 for ; Wed, 22 Sep 2021 10:09:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:subject:in-reply-to :content-transfer-encoding; bh=4/ZS+BgLkXIjhPXysCz/zxL+dwCaYiXpKP90ibz6DsA=; b=AdIZX86lCC5pYBr3lk+F/p/mAqtw+AyYz6jiReifJIE30VPzQAAoMBVbNtTFaVavED XqF3epRvvaq+SCprJWwPlvKuYPlgjN2ehe0cpXfQEWCCaQ1AAtkmUVrB5ZSOrnlTo2Q5 6yexpbhsr32zhfE0gELVFmpg5Ah0r/x+C1ohcq2u5T8VZ9SFLY/QFp/VVjbN5dq/qx12 vfMyY9q8y1erFRKwIpUgljcCo1iYpCqjAIrcNfaR3DJvGrOZi+OjyYAhRJnKK8EqyBON gj/c/Sr9a2lbr10Pno/Dqyz9nZDRqPQD3b8skxVm4qOp3/MGQNuq5+/JVGQ46OSn53U0 F7xA== X-Gm-Message-State: AOAM533HOPOSgjk7awkNLaAsnweM2vkxsCeZqDqy04Cdz+o8JDIpTgAD SpvqSqGcNhDp5VX1d5+n2pk7UGKfNJx5ra3lbStDHk+D1oytSD7ThaotTI0xBKRjYUrIxhGqn8+ C9uk= X-Received: by 2002:a7b:cd0f:: with SMTP id f15mr95120wmj.173.1632330592254; Wed, 22 Sep 2021 10:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy77EImn8jHRoQBa8mCGFnL/cWXFXZhnUSUCPeOQclpRePk/NiWwJxQGIZTBbOcE3ZBt4XVQ== X-Received: by 2002:a7b:cd0f:: with SMTP id f15mr95098wmj.173.1632330592066; Wed, 22 Sep 2021 10:09:52 -0700 (PDT) Received: from [192.168.0.36] ([78.18.26.217]) by smtp.gmail.com with ESMTPSA id i67sm3077254wmi.41.2021.09.22.10.09.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Sep 2021 10:09:51 -0700 (PDT) Message-ID: <32dc9e20-86dc-a0a6-74a2-9894cb680170@redhat.com> Date: Wed, 22 Sep 2021 18:09:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 To: Xueming Li , dev@dpdk.org Cc: Thomas Monjalon , Cristian Dumitrescu , Jasvinder Singh References: <20210823081539.1410259-1-xuemingl@nvidia.com> <20210915102610.83105-1-xuemingl@nvidia.com> From: Kevin Traynor In-Reply-To: <20210915102610.83105-1-xuemingl@nvidia.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1] sched: adds function to get 64 bits greatest common divisor X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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: >