[dpdk-dev,RFC,06/11] ring: use existing power-of-2 function
Checks
Commit Message
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(-)
@@ -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);