git: cdbff1b29996 - main - linuxkpi: Remove incorrect + 1 from HWEIGHT* macros
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Jun 2025 22:42:50 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=cdbff1b2999660b31b2de076d04670722a555ed2
commit cdbff1b2999660b31b2de076d04670722a555ed2
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2025-06-24 13:36:54 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-06-24 22:42:16 +0000
linuxkpi: Remove incorrect + 1 from HWEIGHT* macros
Fixes: 4cc8a9da491d ("LinuxKPI: add HWEIGHT32()")
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51010
---
sys/compat/linuxkpi/common/include/linux/bitops.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index 23aabb546cb2..bc776a0db9c4 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -62,10 +62,10 @@
#define hweight64(x) bitcount64(x)
#define hweight_long(x) bitcountl(x)
-#define HWEIGHT8(x) (bitcount8((uint8_t)(x)) + 1)
-#define HWEIGHT16(x) (bitcount16(x) + 1)
-#define HWEIGHT32(x) (bitcount32(x) + 1)
-#define HWEIGHT64(x) (bitcount64(x) + 1)
+#define HWEIGHT8(x) (bitcount8((uint8_t)(x)))
+#define HWEIGHT16(x) (bitcount16(x))
+#define HWEIGHT32(x) (bitcount32(x))
+#define HWEIGHT64(x) (bitcount64(x))
static inline int
__ffs(int mask)