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
This commit is contained in:
Bjoern A. Zeeb 2021-05-27 13:09:40 +00:00
parent 9b6835f3ab
commit 4cc8a9da49

View File

@ -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)
{