diff mbox series

[5/6] testpmd: use library implementation of 64-bit log2

Message ID 723491152c80082b01ca2f6fb44cd1cf66968047.1544550999.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series [1/6] bitmap: remove deprecated bsf64 function | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Burakov, Anatoly Dec. 11, 2018, 5:57 p.m. UTC
Remove duplicated code and use library version of 64-bit log2.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 app/test-pmd/testpmd.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

Comments

Bernard Iremonger Dec. 12, 2018, 11:22 a.m. UTC | #1
> -----Original Message-----
> From: Burakov, Anatoly
> Sent: Tuesday, December 11, 2018 5:57 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>;
> thomas@monjalon.net; Singh, Jasvinder <jasvinder.singh@intel.com>;
> Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> jerin.jacob@caviumnetworks.com
> Subject: [PATCH 5/6] testpmd: use library implementation of 64-bit log2
> 
> Remove duplicated code and use library version of 64-bit log2.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---

./devtools/check-git-log.sh -1
Wrong headline label:
        testpmd: use library implementation of 64-bit log2

Should be app/testpmd:

Otherwise

Acked-by: Bernard Iremonger <ernard.iremonger@intel.com>
diff mbox series

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4c75587d0..0c75e123b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -649,28 +649,13 @@  calc_mem_size(uint32_t nb_mbufs, uint32_t mbuf_sz, size_t pgsz, size_t *out)
 	return 0;
 }
 
-static inline uint32_t
-bsf64(uint64_t v)
-{
-	return (uint32_t)__builtin_ctzll(v);
-}
-
-static inline uint32_t
-log2_u64(uint64_t v)
-{
-	if (v == 0)
-		return 0;
-	v = rte_align64pow2(v);
-	return bsf64(v);
-}
-
 static int
 pagesz_flags(uint64_t page_sz)
 {
 	/* as per mmap() manpage, all page sizes are log2 of page size
 	 * shifted by MAP_HUGE_SHIFT
 	 */
-	int log2 = log2_u64(page_sz);
+	int log2 = rte_log2_u64(page_sz);
 
 	return (log2 << HUGE_SHIFT);
 }