#include <rte_branch_prediction.h>
#include <rte_prefetch.h>
-#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
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,