DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, Joyce Kong <joyce.kong@arm.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH] eal: use abstracted bit count functions
Date: Sun, 15 Oct 2023 18:29:22 -0700	[thread overview]
Message-ID: <1697419762-13259-1-git-send-email-roretzla@linux.microsoft.com> (raw)

Use DPDK abstracted bitcount functions in rte_bsf and rte_fls inline
functions.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_bitops.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h
index d45aa54..6b8ae8d 100644
--- a/lib/eal/include/rte_bitops.h
+++ b/lib/eal/include/rte_bitops.h
@@ -574,7 +574,7 @@
 static inline uint32_t
 rte_bsf32(uint32_t v)
 {
-	return (uint32_t)__builtin_ctz(v);
+	return (uint32_t)rte_ctz32(v);
 }
 
 /**
@@ -615,7 +615,7 @@
 static inline uint32_t
 rte_bsf64(uint64_t v)
 {
-	return (uint32_t)__builtin_ctzll(v);
+	return (uint32_t)rte_ctz64(v);
 }
 
 /**
@@ -656,7 +656,7 @@
 static inline uint32_t
 rte_fls_u32(uint32_t x)
 {
-	return (x == 0) ? 0 : 32 - __builtin_clz(x);
+	return (x == 0) ? 0 : 32 - rte_clz32(x);
 }
 
 /**
@@ -674,7 +674,7 @@
 static inline uint32_t
 rte_fls_u64(uint64_t x)
 {
-	return (x == 0) ? 0 : 64 - __builtin_clzll(x);
+	return (x == 0) ? 0 : 64 - rte_clz64(x);
 }
 
 /*********** Macros to work with powers of 2 ********/
-- 
1.8.3.1


             reply	other threads:[~2023-10-16  1:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  1:29 Tyler Retzlaff [this message]
2023-10-16  2:06 ` [PATCH v2] " Tyler Retzlaff
2023-10-17 12:55   ` Thomas Monjalon

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=1697419762-13259-1-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=joyce.kong@arm.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).