From 8a8a6efcabc315880987c81afe69a90d738cc970 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 23 Aug 2022 23:38:39 +0800 Subject: [PATCH] include/intarith: s/8/CHAR_BIT/ less magic numbers Signed-off-by: Kefu Chai --- src/include/intarith.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/include/intarith.h b/src/include/intarith.h index 86002c312ba67..68b0345a457e2 100644 --- a/src/include/intarith.h +++ b/src/include/intarith.h @@ -16,6 +16,7 @@ #define CEPH_INTARITH_H #include +#include #include #include @@ -86,7 +87,7 @@ constexpr inline T p2roundup(T x, T align) { // count bits (set + any 0's that follow) template unsigned cbits(T v) { - return (sizeof(v) * 8) - std::countl_zero(std::make_unsigned_t(v)); + return (sizeof(v) * CHAR_BIT) - std::countl_zero(std::make_unsigned_t(v)); } #endif -- 2.39.5