From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 72917F943 for ; Wed, 11 Jan 2017 16:06:06 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 11 Jan 2017 07:06:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="29056785" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga002.jf.intel.com with ESMTP; 11 Jan 2017 07:06:05 -0800 From: Bruce Richardson To: olivier.matz@6wind.com Cc: dev@dpdk.org, Bruce Richardson Date: Wed, 11 Jan 2017 15:05:20 +0000 Message-Id: <1484147125-5948-7-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1484147125-5948-1-git-send-email-bruce.richardson@intel.com> References: <1484147125-5948-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [RFC PATCH 06/11] ring: use existing power-of-2 function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2017 15:06:06 -0000 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 --- lib/librte_ring/rte_typed_ring.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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); -- 2.9.3