git: f674f016c03d - main - LinuxKPI: add BITS_TO_BYTES()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Apr 2024 23:12:29 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=f674f016c03d49e14f1c651ed088a6f2d01a62ee
commit f674f016c03d49e14f1c651ed088a6f2d01a62ee
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-04-02 23:48:05 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-04-12 23:11:47 +0000
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
---
sys/compat/linuxkpi/common/include/linux/bitops.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index 58677631b604..1415d5224084 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -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)