[PATCH] lib: sbi: Simplify BITS_PER_LONG definition

Anup Patel anup at brainfault.org
Thu May 11 00:28:00 PDT 2023


On Tue, Apr 25, 2023 at 5:03 PM Xiang W <wxjstz at 126.com> wrote:
>
> Signed-off-by: Xiang W <wxjstz at 126.com>

Please don't leave the commit description empty. Otherwise it looks good to me.

Reviewed-by: Anup Patel <anup at brainfault.org>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  include/sbi/sbi_bitops.h | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h
> index 251e4d8..2e08947 100644
> --- a/include/sbi/sbi_bitops.h
> +++ b/include/sbi/sbi_bitops.h
> @@ -12,13 +12,7 @@
>
>  #include <sbi/sbi_types.h>
>
> -#if __SIZEOF_POINTER__ == 8
> -#define BITS_PER_LONG          64
> -#elif __SIZEOF_POINTER__ == 4
> -#define BITS_PER_LONG          32
> -#else
> -#error "Unexpected __SIZEOF_POINTER__"
> -#endif
> +#define BITS_PER_LONG          (8 * __SIZEOF_LONG__)
>
>  #define EXTRACT_FIELD(val, which) \
>         (((val) & (which)) / ((which) & ~((which)-1)))
> --
> 2.39.2
>



More information about the opensbi mailing list