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 17C9A1B163 for ; Wed, 14 Nov 2018 17:30:29 +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:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,233,1539673200"; d="scan'208";a="273971218" 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 wAEGUQK3029217; 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 wAEGUPxP007173; Wed, 14 Nov 2018 16:30:25 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id wAEGUP6w007167; Wed, 14 Nov 2018 16:30:25 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:30:22 +0000 Message-Id: <0e6285d5999fc0bdecf2f764085ca287d44274ce.1542212598.git.anatoly.burakov@intel.com> 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 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:30:31 -0000 Remove duplicated code and use library version of 64-bit log2. Signed-off-by: Anatoly Burakov --- 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