From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 94ECC1B13B for ; Wed, 14 Nov 2018 17:47:14 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2018 08:47:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,233,1539673200"; d="scan'208";a="104353049" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 14 Nov 2018 08:47:12 -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 wAEGlBT0032581; Wed, 14 Nov 2018 16:47:11 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id wAEGlBV3017306; Wed, 14 Nov 2018 16:47:11 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id wAEGlBl2017302; Wed, 14 Nov 2018 16:47:11 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: 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:47:09 +0000 Message-Id: <0876a046d35ecdfff08c7b1f0f13914881fc0a1f.1542213812.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 4/5] memalloc: 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:47:15 -0000 Remove duplicated code and use library version of 64-bit log2. Signed-off-by: Anatoly Burakov Acked-by: Cristian Dumitrescu --- lib/librte_eal/linuxapp/eal/eal_memalloc.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c index 48b9c7360..7f9f0d027 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c +++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c @@ -208,28 +208,13 @@ get_file_size(int fd) return st.st_size; } -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 << RTE_MAP_HUGE_SHIFT; } -- 2.17.1