[dpdk-dev,RFC,06/11] ring: use existing power-of-2 function

Message ID 1484147125-5948-7-git-send-email-bruce.richardson@intel.com (mailing list archive)
State RFC, archived
Delegated to: Ferruh Yigit
Headers

Checks

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

Commit Message

Bruce Richardson Jan. 11, 2017, 3:05 p.m. UTC
  rather than having a special macro for checking for powers of two in
the ring code, use the existing inline function from rte_common.h

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_ring/rte_typed_ring.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Patch

diff --git a/lib/librte_ring/rte_typed_ring.h b/lib/librte_ring/rte_typed_ring.h
index 03a9bd7..3f7514f 100644
--- a/lib/librte_ring/rte_typed_ring.h
+++ b/lib/librte_ring/rte_typed_ring.h
@@ -1150,9 +1150,6 @@  TAILQ_HEAD(rte_ring_list, rte_tailq_entry);
 
 extern struct rte_tailq_elem rte_ring_tailq;
 
-/* true if x is a power of 2 */
-#define POWEROF2(x) ((((x)-1) & (x)) == 0)
-
 /**
  * Calculate the memory size needed for a ring
  *
@@ -1173,7 +1170,7 @@  TYPE(ring_get_memsize)(unsigned int count)
 	ssize_t sz;
 
 	/* count must be a power of 2 */
-	if ((!POWEROF2(count)) || (count > RTE_RING_SZ_MASK)) {
+	if ((!rte_is_power_of_2(count)) || (count > RTE_RING_SZ_MASK)) {
 		RTE_LOG(ERR, RING,
 			"Requested size is invalid, must be power of 2, and "
 			"do not exceed the size limit %u\n", RTE_RING_SZ_MASK);