[PATCH] eal: fix return type of bsf safe functions
Mattias Rönnblom
hofors at lysator.liu.se
Thu Oct 6 20:20:48 CEST 2022
On 2022-10-05 17:40, Thomas Monjalon wrote:
> In a recent commit, changing return type from int to uint32_t,
> I did a last minute change to functions rte_bsf32_safe and rte_bsf64_safe,
> because thought they were forgotten.
> Actually these functions are returning 0 or 1, so it should be int.
Wouldn't bool be a better choice?
> The return type is reverted to the original type for these 2 functions.
>
> Fixes: 4b81c145ae37 ("eal: change return type of bsf/fls functions")
>
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> ---
> lib/eal/include/rte_common.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
> index 23d9e05cbb..15765b408d 100644
> --- a/lib/eal/include/rte_common.h
> +++ b/lib/eal/include/rte_common.h
> @@ -660,7 +660,7 @@ rte_bsf32(uint32_t v)
> * @return
> * Returns 0 if ``v`` was 0, otherwise returns 1.
> */
> -static inline uint32_t
> +static inline int
> rte_bsf32_safe(uint32_t v, uint32_t *pos)
> {
> if (v == 0)
> @@ -739,7 +739,7 @@ rte_bsf64(uint64_t v)
> * @return
> * Returns 0 if ``v`` was 0, otherwise returns 1.
> */
> -static inline uint32_t
> +static inline int
> rte_bsf64_safe(uint64_t v, uint32_t *pos)
> {
> if (v == 0)
More information about the dev
mailing list