Deprecation Notices
-------------------
+* eal: function ``rte_bsf64`` in ``rte_bitmap.h`` has been renamed to
+ ``rte_bsf64_safe`` and moved to ``rte_common.h``. A new ``rte_bsf64`` function
+ will be added in the next release in ``rte_common.h`` that follows convention
+ set by existing ``rte_bsf32`` function.
+
* eal: both declaring and identifying devices will be streamlined in v18.11.
New functions will appear to query a specific port from buses, classes of
device and device drivers. Device declaration will be made coherent with the
bmp->index2 = (((bmp->index1 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2) + bmp->offset1) << RTE_BITMAP_CL_SLAB_SIZE_LOG2);
}
-static inline int
+static inline int __rte_deprecated
rte_bsf64(uint64_t slab, uint32_t *pos)
{
- if (slab == 0)
- return 0;
-
- *pos = __builtin_ctzll(slab);
- return 1;
+ return rte_bsf64_safe(slab, pos);
}
static inline uint32_t
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;
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;
return (x == 0) ? 0 : 32 - __builtin_clz(x);
}
+/**
+ * Searches the input parameter for the least significant set bit
+ * (starting from zero). Safe version (checks for input parameter being zero).
+ *
+ * @warning ``pos`` must be a valid pointer. It is not checked!
+ *
+ * @param v
+ * The input parameter.
+ * @param pos
+ * If ``v`` was not 0, this value will contain position of least significant
+ * bit within the input parameter.
+ * @return
+ * Returns 0 if ``v`` was 0, otherwise returns 1.
+ */
+static inline int
+rte_bsf64_safe(uint64_t v, uint32_t *pos)
+{
+ if (v == 0)
+ return 0;
+
+ *pos = __builtin_ctzll(v);
+ return 1;
+}
#ifndef offsetof
/** Return the offset of a field in a structure. */