eal: change return type of bsf/fls functions
The function return type is changed to fixed width uint32_t to be consistent with what appears to be the original authors intent. It doesn't make much sense to return signed integers for these functions. Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Morten Brørup <mb@smartsharesystems.com> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
This commit is contained in:
parent
2973dbf93b
commit
4b81c145ae
@ -2677,7 +2677,7 @@ test_mbuf_dyn(struct rte_mempool *pktmbuf_pool)
|
||||
|
||||
flag3 = rte_mbuf_dynflag_register_bitnum(&dynflag3,
|
||||
rte_bsf64(RTE_MBUF_F_LAST_FREE));
|
||||
if (flag3 != rte_bsf64(RTE_MBUF_F_LAST_FREE))
|
||||
if ((uint32_t)flag3 != rte_bsf64(RTE_MBUF_F_LAST_FREE))
|
||||
GOTO_FAIL("failed to register dynamic flag 3, flag3=%d: %s",
|
||||
flag3, strerror(errno));
|
||||
|
||||
|
@ -176,6 +176,9 @@ API Changes
|
||||
* eal: Updated ``rte_eal_remote_launch`` so it returns -EPIPE in case of
|
||||
a read or write error on the pipe, instead of calling ``rte_panic``.
|
||||
|
||||
* eal: Updated return types for rte_{bsf,fls} inline functions
|
||||
to be consistently ``uint32_t``.
|
||||
|
||||
* mempool: Deprecated helper macro ``MEMPOOL_HEADER_SIZE()`` is removed.
|
||||
The replacement macro ``RTE_MEMPOOL_HEADER_SIZE()`` is internal only.
|
||||
|
||||
|
@ -660,7 +660,7 @@ rte_bsf32(uint32_t v)
|
||||
* @return
|
||||
* Returns 0 if ``v`` was 0, otherwise returns 1.
|
||||
*/
|
||||
static inline int
|
||||
static inline uint32_t
|
||||
rte_bsf32_safe(uint32_t v, uint32_t *pos)
|
||||
{
|
||||
if (v == 0)
|
||||
@ -702,7 +702,7 @@ rte_log2_u32(uint32_t v)
|
||||
* @return
|
||||
* The last (most-significant) bit set, or 0 if the input is 0.
|
||||
*/
|
||||
static inline int
|
||||
static inline uint32_t
|
||||
rte_fls_u32(uint32_t x)
|
||||
{
|
||||
return (x == 0) ? 0 : 32 - __builtin_clz(x);
|
||||
@ -719,7 +719,7 @@ rte_fls_u32(uint32_t x)
|
||||
* @return
|
||||
* least significant set bit in the input parameter.
|
||||
*/
|
||||
static inline int
|
||||
static inline uint32_t
|
||||
rte_bsf64(uint64_t v)
|
||||
{
|
||||
return (uint32_t)__builtin_ctzll(v);
|
||||
@ -739,7 +739,7 @@ rte_bsf64(uint64_t v)
|
||||
* @return
|
||||
* Returns 0 if ``v`` was 0, otherwise returns 1.
|
||||
*/
|
||||
static inline int
|
||||
static inline uint32_t
|
||||
rte_bsf64_safe(uint64_t v, uint32_t *pos)
|
||||
{
|
||||
if (v == 0)
|
||||
@ -761,7 +761,7 @@ rte_bsf64_safe(uint64_t v, uint32_t *pos)
|
||||
* @return
|
||||
* The last (most-significant) bit set, or 0 if the input is 0.
|
||||
*/
|
||||
static inline int
|
||||
static inline uint32_t
|
||||
rte_fls_u64(uint64_t x)
|
||||
{
|
||||
return (x == 0) ? 0 : 64 - __builtin_clzll(x);
|
||||
|
Loading…
Reference in New Issue
Block a user