From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 6CCD01DB9 for ; Wed, 21 Nov 2018 13:05:07 +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 orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2018 04:05:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,261,1539673200"; d="scan'208";a="106489566" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 21 Nov 2018 04:05:04 -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 wALC53Fj017463; Wed, 21 Nov 2018 12:05:03 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id wALC53Jm013872; Wed, 21 Nov 2018 12:05:03 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id wALC530Q013868; Wed, 21 Nov 2018 12:05:03 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: Cristian Dumitrescu , jasvinder.singh@intel.com, ferruh.yigit@intel.com, bruce.richardson@intel.com, thomas@monjalon.net Date: Wed, 21 Nov 2018 12:05:02 +0000 Message-Id: <6279ff04d7d477d3c2c076c643a0093aecb654c6.1542801670.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH 1/2] bitmap: remove useless code 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, 21 Nov 2018 12:05:08 -0000 RTE_BITMAP_OPTIMIZATIONS was never set to 0 and makes no sense anyway, so remove all code related to it. Also, drop the "likely" for bsf64 code, because it's a generic function and we cannot make any assumptions about likely values of incoming arguments. Signed-off-by: Anatoly Burakov Acked-by: Cristian Dumitrescu --- lib/librte_eal/common/include/rte_bitmap.h | 33 +--------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/lib/librte_eal/common/include/rte_bitmap.h b/lib/librte_eal/common/include/rte_bitmap.h index 7a36ce73c..d2ed6204c 100644 --- a/lib/librte_eal/common/include/rte_bitmap.h +++ b/lib/librte_eal/common/include/rte_bitmap.h @@ -43,10 +43,6 @@ extern "C" { #include #include -#ifndef RTE_BITMAP_OPTIMIZATIONS -#define RTE_BITMAP_OPTIMIZATIONS 1 -#endif - /* Slab */ #define RTE_BITMAP_SLAB_BIT_SIZE 64 #define RTE_BITMAP_SLAB_BIT_SIZE_LOG2 6 @@ -97,43 +93,16 @@ __rte_bitmap_index2_set(struct rte_bitmap *bmp) bmp->index2 = (((bmp->index1 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2) + bmp->offset1) << RTE_BITMAP_CL_SLAB_SIZE_LOG2); } -#if RTE_BITMAP_OPTIMIZATIONS - static inline int rte_bsf64(uint64_t slab, uint32_t *pos) { - if (likely(slab == 0)) { + if (slab == 0) return 0; - } *pos = __builtin_ctzll(slab); return 1; } -#else - -static inline int -rte_bsf64(uint64_t slab, uint32_t *pos) -{ - uint64_t mask; - uint32_t i; - - if (likely(slab == 0)) { - return 0; - } - - for (i = 0, mask = 1; i < RTE_BITMAP_SLAB_BIT_SIZE; i ++, mask <<= 1) { - if (unlikely(slab & mask)) { - *pos = i; - return 1; - } - } - - return 0; -} - -#endif - static inline uint32_t __rte_bitmap_get_memory_footprint(uint32_t n_bits, uint32_t *array1_byte_offset, uint32_t *array1_slabs, -- 2.17.1