aboutsummaryrefslogtreecommitdiff
path: root/include/sbi/sbi_bitops.h
diff options
context:
space:
mode:
authorXiang W <wxjstz@126.com>2023-04-25 19:32:21 +0800
committerAnup Patel <anup@brainfault.org>2023-05-11 12:56:56 +0530
commitdc1c7db05e075e0910b93504370b50d064a51402 (patch)
tree785cd344e8c0ba6358b48f214853ca59ae753ca4 /include/sbi/sbi_bitops.h
parent6bc02dede86c47f87e65293b7099e9caf3b22c29 (diff)
downloadopensbi-dc1c7db05e075e0910b93504370b50d064a51402.zip
opensbi-dc1c7db05e075e0910b93504370b50d064a51402.tar.gz
opensbi-dc1c7db05e075e0910b93504370b50d064a51402.tar.bz2
lib: sbi: Simplify BITS_PER_LONG definition
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>
Diffstat (limited to 'include/sbi/sbi_bitops.h')
-rw-r--r--include/sbi/sbi_bitops.h8
1 files changed, 1 insertions, 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)))