lib: sbi: Simplify BITS_PER_LONG definition
authorXiang W <wxjstz@126.com>
Tue, 25 Apr 2023 11:32:21 +0000 (19:32 +0800)
committerAnup Patel <anup@brainfault.org>
Thu, 11 May 2023 07:26:56 +0000 (12:56 +0530)
No need to use #elif ladder when defining BITS_PER_LONG.

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
include/sbi/sbi_bitops.h

index 251e4d8..2e08947 100644 (file)
 
 #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)))