bitset: expand bit index type to long

An upcoming patch to use the bitset macros for tracking vm page
dump information could conceivably need more than INT_MAX bits.
Expand the bit type to long so that the extra range is available
on 64-bit platforms where it would most likely be needed.

CPUSET_COUNT and DOMAINSET_COUNT are also modified to remain of
type `int`.

Reviewed by:	kib, markj
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26190
This commit is contained in:
D Scott Phillips 2020-09-21 22:19:12 +00:00
parent 191dad8b0a
commit 26a3bf76c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365975
4 changed files with 10 additions and 11 deletions

View File

@ -84,13 +84,13 @@
.Fn BIT_EMPTY "const SETSIZE" "struct STRUCTNAME *bitset"
.Ft bool
.Fn BIT_ISFULLSET "const SETSIZE" "struct STRUCTNAME *bitset"
.Ft int
.Ft long
.Fn BIT_FFS "const SETSIZE" "struct STRUCTNAME *bitset"
.Ft int
.Fn BIT_FFS_AT "const SETSIZE" "struct STRUCTNAME *bitset" "int start"
.Ft int
.Ft long
.Fn BIT_FFS_AT "const SETSIZE" "struct STRUCTNAME *bitset" "long start"
.Ft long
.Fn BIT_FLS "const SETSIZE" "struct STRUCTNAME *bitset"
.Ft int
.Ft long
.Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset"
.\"
.Ft bool

View File

@ -213,8 +213,7 @@
*/
#define BIT_FFS_AT(_s, p, start) __extension__ ({ \
__size_t __i; \
long __mask; \
int __bit; \
long __bit, __mask; \
\
__mask = ~0UL << ((start) % _BITSET_BITS); \
__bit = 0; \
@ -235,7 +234,7 @@
#define BIT_FLS(_s, p) __extension__ ({ \
__size_t __i; \
int __bit; \
long __bit; \
\
__bit = 0; \
for (__i = __bitset_words((_s)); __i > 0; __i--) { \
@ -250,7 +249,7 @@
#define BIT_COUNT(_s, p) __extension__ ({ \
__size_t __i; \
int __count; \
long __count; \
\
__count = 0; \
for (__i = 0; __i < __bitset_words((_s)); __i++) \

View File

@ -65,7 +65,7 @@
#define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s)
#define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t)
#define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p)
#define CPU_COUNT(p) BIT_COUNT(CPU_SETSIZE, p)
#define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p))
#define CPUSET_FSET BITSET_FSET(_NCPUWORDS)
#define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER

View File

@ -68,7 +68,7 @@
BIT_COPY_STORE_REL(DOMAINSET_SETSIZE, f, t)
#define DOMAINSET_FFS(p) BIT_FFS(DOMAINSET_SETSIZE, p)
#define DOMAINSET_FLS(p) BIT_FLS(DOMAINSET_SETSIZE, p)
#define DOMAINSET_COUNT(p) BIT_COUNT(DOMAINSET_SETSIZE, p)
#define DOMAINSET_COUNT(p) ((int)BIT_COUNT(DOMAINSET_SETSIZE, p))
#define DOMAINSET_FSET BITSET_FSET(_NDOMAINSETWORDS)
#define DOMAINSET_T_INITIALIZER BITSET_T_INITIALIZER