Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 May 2021 13:52:40 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4cc8a9da491d - main - LinuxKPI: add HWEIGHT32()
Message-ID:  <202105271352.14RDqeOA040183@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=4cc8a9da491d10f1b4bad6a50730b67dd5e899c7

commit 4cc8a9da491d10f1b4bad6a50730b67dd5e899c7
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-05-27 13:09:40 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-05-27 13:38:30 +0000

    LinuxKPI: add HWEIGHT32()
    
    Add HWEIGHT32() macro needed by iwlwifi and while here add the 8/16/64
    variants likewise.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      12 days
    Reviewed by:    hselasky
    Differential Revision: https://reviews.freebsd.org/D30501
---
 sys/compat/linuxkpi/common/include/linux/bitops.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index 0e25fd3cfb1d..49bfc4cc7414 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -63,6 +63,11 @@
 #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)
+
 static inline int
 __ffs(int mask)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105271352.14RDqeOA040183>