Date: Wed, 22 Oct 2025 14:07:41 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 3e9ad70a30d9 - main - linuxkpi: Fix the definition of BITS_PER_LONG Message-ID: <202510221407.59ME7fDa032995@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e9ad70a30d93fc8bc759af7ec57aaa7e0b2d4f6 commit 3e9ad70a30d93fc8bc759af7ec57aaa7e0b2d4f6 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-10-22 14:04:46 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-10-22 14:04:46 +0000 linuxkpi: Fix the definition of BITS_PER_LONG Don't use __LP64__ to decide the value, as it gives the wrong result on CHERI platforms. Just define it in terms of __SIZEOF_LONG__. Make a similar adjustment for BITS_PER_LONG_LONG while here. Reviewed by: bz, dumbbell, emaste MFC after: 1 week Sponsored by: CHERI Research Centre (EPSRC grant UKRI3001) Differential Revision: https://reviews.freebsd.org/D53135 --- sys/compat/linuxkpi/common/include/linux/bitops.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 00dd1f9a1ec0..a5a7abd55287 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -37,13 +37,8 @@ #define BIT(nr) (1UL << (nr)) #define BIT_ULL(nr) (1ULL << (nr)) -#ifdef __LP64__ -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif - -#define BITS_PER_LONG_LONG 64 +#define BITS_PER_LONG (__SIZEOF_LONG__ * __CHAR_BIT__) +#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * __CHAR_BIT__) #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) #define BITMAP_LAST_WORD_MASK(n) (~0UL >> (BITS_PER_LONG - (n)))home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510221407.59ME7fDa032995>
