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 896891B1E8 for ; Wed, 14 Nov 2018 17:30:32 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2018 08:30:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,233,1539673200"; d="scan'208";a="273971225" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga005.jf.intel.com with ESMTP; 14 Nov 2018 08:30:26 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id wAEGUQFL029220; Wed, 14 Nov 2018 16:30:26 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id wAEGUQpd007205; Wed, 14 Nov 2018 16:30:26 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id wAEGUQDO007201; Wed, 14 Nov 2018 16:30:26 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , cristian.dumitrescu@intel.com, thomas@monjalon.net, bruce.richardson@intel.com, ferruh.yigit@intel.com, jasvinder.singh@intel.com Date: Wed, 14 Nov 2018 16:30:23 +0000 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: <9eb826f80f19422153d5a0ab611fb467a94eded0.1542197039.git.anatoly.burakov@intel.com> References: <9eb826f80f19422153d5a0ab611fb467a94eded0.1542197039.git.anatoly.burakov@intel.com> Subject: [dpdk-dev] [PATCH v2 5/5] testpmd: use library implementation of 64-bit log2 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, 14 Nov 2018 16:30:33 -0000 Remove duplicated code and use library version of 64-bit log2. Signed-off-by: Anatoly Burakov --- app/test-pmd/testpmd.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 9c0edcaed..89c6ffd53 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); } -- 2.17.1