X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Finclude%2Frte_bitmap.h;h=6b846f251b303c6bd20e12ab31a513deb97f3284;hb=df3ff6be2b33faea3edf3c112b9bdc5b74d6f684;hp=7a36ce73c6df4c9f1fa9ad3f3fffcc89b56b640e;hpb=bed70e5deb1bc927c5adb375d15c1d32c6c137d8;p=dpdk.git diff --git a/lib/librte_eal/common/include/rte_bitmap.h b/lib/librte_eal/common/include/rte_bitmap.h index 7a36ce73c6..6b846f251b 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,6 @@ __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)) { - 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, @@ -439,9 +398,8 @@ __rte_bitmap_scan_search(struct rte_bitmap *bmp) value1 = bmp->array1[bmp->index1]; value1 &= __rte_bitmap_mask1_get(bmp); - if (rte_bsf64(value1, &bmp->offset1)) { + if (rte_bsf64_safe(value1, &bmp->offset1)) return 1; - } __rte_bitmap_index1_inc(bmp); bmp->offset1 = 0; @@ -450,9 +408,8 @@ __rte_bitmap_scan_search(struct rte_bitmap *bmp) for (i = 0; i < bmp->array1_size; i ++, __rte_bitmap_index1_inc(bmp)) { value1 = bmp->array1[bmp->index1]; - if (rte_bsf64(value1, &bmp->offset1)) { + if (rte_bsf64_safe(value1, &bmp->offset1)) return 1; - } } return 0;