diff --git a/sys/arm/arm/genassym.c b/sys/arm/arm/genassym.c index f9cb23e810f2..9c67018fed5a 100644 --- a/sys/arm/arm/genassym.c +++ b/sys/arm/arm/genassym.c @@ -28,6 +28,7 @@ #include __FBSDID("$FreeBSD$"); #include +#include #include #include #include diff --git a/sys/sys/_bitset.h b/sys/sys/_bitset.h index 26a8848b27de..86cf539c5abb 100644 --- a/sys/sys/_bitset.h +++ b/sys/sys/_bitset.h @@ -36,26 +36,15 @@ * Macros addressing word and bit within it, tuned to make compiler * optimize cases when SETSIZE fits into single machine word. */ -#define _BITSET_BITS (sizeof(long) * NBBY) +#define _BITSET_BITS (sizeof(long) * 8) -#define __bitset_words(_s) (howmany(_s, _BITSET_BITS)) +#define __howmany(x, y) (((x) + ((y) - 1)) / (y)) -#define __bitset_mask(_s, n) \ - (1L << ((__bitset_words((_s)) == 1) ? \ - (__size_t)(n) : ((n) % _BITSET_BITS))) - -#define __bitset_word(_s, n) \ - ((__bitset_words((_s)) == 1) ? 0 : ((n) / _BITSET_BITS)) +#define __bitset_words(_s) (__howmany(_s, _BITSET_BITS)) #define BITSET_DEFINE(t, _s) \ struct t { \ long __bits[__bitset_words((_s))]; \ } -#define BITSET_T_INITIALIZER(x) \ - { .__bits = { x } } - -#define BITSET_FSET(n) \ - [ 0 ... ((n) - 1) ] = (-1L) - #endif /* !_SYS__BITSET_H_ */ diff --git a/sys/sys/_cpuset.h b/sys/sys/_cpuset.h index cd3848489417..1ddafac2c7c2 100644 --- a/sys/sys/_cpuset.h +++ b/sys/sys/_cpuset.h @@ -44,13 +44,7 @@ #define CPU_SETSIZE CPU_MAXSIZE #endif -#define _NCPUBITS _BITSET_BITS -#define _NCPUWORDS __bitset_words(CPU_SETSIZE) - BITSET_DEFINE(_cpuset, CPU_SETSIZE); typedef struct _cpuset cpuset_t; -#define CPUSET_FSET BITSET_FSET(_NCPUWORDS) -#define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER - #endif /* !_SYS__CPUSET_H_ */ diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h index d130522742bb..f1c7bf8e0e6d 100644 --- a/sys/sys/bitset.h +++ b/sys/sys/bitset.h @@ -32,6 +32,13 @@ #ifndef _SYS_BITSET_H_ #define _SYS_BITSET_H_ +#define __bitset_mask(_s, n) \ + (1L << ((__bitset_words((_s)) == 1) ? \ + (__size_t)(n) : ((n) % _BITSET_BITS))) + +#define __bitset_word(_s, n) \ + ((__bitset_words((_s)) == 1) ? 0 : ((n) / _BITSET_BITS)) + #define BIT_CLR(_s, n, p) \ ((p)->__bits[__bitset_word(_s, n)] &= ~__bitset_mask((_s), (n))) @@ -185,5 +192,11 @@ __count += __bitcountl((p)->__bits[__i]); \ __count; \ }) - + +#define BITSET_T_INITIALIZER(x) \ + { .__bits = { x } } + +#define BITSET_FSET(n) \ + [ 0 ... ((n) - 1) ] = (-1L) + #endif /* !_SYS_BITSET_H_ */ diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h index 4fa55a9b77ea..e01788345795 100644 --- a/sys/sys/cpuset.h +++ b/sys/sys/cpuset.h @@ -35,6 +35,10 @@ #include #include +#include + +#define _NCPUBITS _BITSET_BITS +#define _NCPUWORDS __bitset_words(CPU_SETSIZE) #define CPUSETBUFSIZ ((2 + sizeof(long) * 2) * _NCPUWORDS) @@ -61,6 +65,8 @@ #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 CPUSET_FSET BITSET_FSET(_NCPUWORDS) +#define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER /* * Valid cpulevel_t values.