LinuxKPI: add BITS_TO_BYTES()

Just like BITS_TO_LONG() ... used in rtw89.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D44603
This commit is contained in:
Bjoern A. Zeeb 2024-04-02 23:48:05 +00:00
parent 218b2ccf8c
commit f674f016c0

View file

@ -54,6 +54,7 @@
#define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
#define BITS_PER_BYTE 8
#define BITS_PER_TYPE(t) (sizeof(t) * BITS_PER_BYTE)
#define BITS_TO_BYTES(n) howmany((n), BITS_PER_BYTE)
#define hweight8(x) bitcount((uint8_t)(x))
#define hweight16(x) bitcount16(x)