Index: include/bitstring.h =================================================================== --- include/bitstring.h +++ include/bitstring.h @@ -31,6 +31,7 @@ #include #include +#include #include #endif /* _BITSTRING_H_ */ Index: sys/sys/bitstring.h =================================================================== --- sys/sys/bitstring.h +++ sys/sys/bitstring.h @@ -65,6 +65,7 @@ #ifdef _KERNEL #include #include +#include #endif #include @@ -105,8 +106,7 @@ /*----------------------------- Public Interface -----------------------------*/ /* Number of bytes consumed by a bit string of nbits bits */ -#define bitstr_size(_nbits) \ - (((_nbits) + _BITSTR_BITS - 1) / 8) +#define bitstr_size(_nbits) (howmany(_nbits, 8)) /* Allocate a bit string initialized with no bits set. */ #ifdef _KERNEL @@ -125,7 +125,7 @@ /* Allocate a bit string on the stack with no bits set. */ #define bit_decl(name, nbits) \ - ((name)[bitstr_size(nbits) / sizeof(bitstr_t)]) + ((name)[howmany(bitstr_size(nbits), sizeof(bitstr_t))]) /* Is bit N of bit string set? */ static inline int