DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"cristian.dumitrescu@intel.com" <cristian.dumitrescu@intel.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"bruce.richardson@intel.com" <bruce.richardson@intel.com>,
	"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	"jasvinder.singh@intel.com" <jasvinder.singh@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3 3/5] common: add missing implementations
Date: Thu, 15 Nov 2018 10:07:52 +0000	[thread overview]
Message-ID: <ba9757ca-7446-8f08-9c59-6d18c6182acd@intel.com> (raw)
In-Reply-To: <20181115083955.GA4757@jerin>

On 15-Nov-18 8:40 AM, Jerin Jacob wrote:
> -----Original Message-----
>> Date: Wed, 14 Nov 2018 16:47:08 +0000
>> From: Anatoly Burakov <anatoly.burakov@intel.com>
>> To: dev@dpdk.org
>> CC: cristian.dumitrescu@intel.com, thomas@monjalon.net,
>>   bruce.richardson@intel.com, ferruh.yigit@intel.com,
>>   jasvinder.singh@intel.com
>> Subject: [dpdk-dev] [PATCH v3 3/5] common: add missing implementations
>> X-Mailer: git-send-email 1.7.0.7
>>
>> External Email
>>
>> Implement missing functions for 32-bit safe bsf, as well as 64-bit
>> fls and log2.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>> ---
> 
>> +/**
>> + * Return the last (most-significant) bit set.
>> + *
>> + * @note The last (most significant) bit is at position 32.
> 
> s/position 32/position 64
> 
>> + * @note rte_fls_u32(0) = 0, rte_fls_u32(1) = 1, rte_fls_u32(0x80000000) = 32
> 
> Fix here too
> 
> IMO, it is better to add unit test case for newly added common functions
> in test/test/test_common.c

Good catches and good ideas, thanks!

> 
>> + *
>> + * @param x
>> + *     The input parameter.
>> + * @return
>> + *     The last (most-significant) bit set, or 0 if the input is 0.
>> + */
>> +static inline int
>> +rte_fls_u64(uint64_t x)
>> +{
>> +       return (x == 0) ? 0 : 64 - __builtin_clzll(x);
>> +}
>> +
> 


-- 
Thanks,
Anatoly

  reply	other threads:[~2018-11-15 10:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 12:11 [dpdk-dev] [PATCH] bitmap: deprecate rte_bsf64 Anatoly Burakov
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 1/5] bitmap: remove useless code Anatoly Burakov
2018-11-14 16:40   ` Dumitrescu, Cristian
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 2/5] bitmap: rename rte_bsf64 and move to common header Anatoly Burakov
2018-11-14 16:52     ` Singh, Jasvinder
2018-11-22 16:54       ` Hunt, David
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 3/5] common: add missing implementations Anatoly Burakov
2018-11-15  8:40     ` Jerin Jacob
2018-11-15 10:07       ` Burakov, Anatoly [this message]
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 4/5] memalloc: use library implementation of 64-bit log2 Anatoly Burakov
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 5/5] testpmd: " Anatoly Burakov
2018-11-15 10:08   ` [dpdk-dev] [PATCH v2 1/5] bitmap: remove useless code Burakov, Anatoly
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 2/5] bitmap: rename rte_bsf64 and move to common header Anatoly Burakov
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 3/5] common: add missing implementations Anatoly Burakov
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 4/5] memalloc: use library implementation of 64-bit log2 Anatoly Burakov
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 5/5] testpmd: " Anatoly Burakov

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=ba9757ca-7446-8f08-9c59-6d18c6182acd@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jasvinder.singh@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=thomas@monjalon.net \
    /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).