Lines Matching defs:_nbits
116 #define bitstr_size(_nbits) (_bit_roundup2(_nbits, _BITSTR_BITS) / 8)
121 bit_alloc(int _nbits, struct malloc_type *type, int flags)
123 return ((bitstr_t *)malloc(bitstr_size(_nbits), type, flags | M_ZERO));
127 bit_alloc(int _nbits)
129 return ((bitstr_t *)calloc(bitstr_size(_nbits), 1));
198 bit_ffs_at(bitstr_t *_bitstr, int _start, int _nbits, int *_result)
205 if (_nbits > 0) {
207 _stopbitstr = _bitstr + _bit_idx(_nbits - 1);
217 if (_offset == 0 || _value >= _nbits)
227 bit_ffc_at(bitstr_t *_bitstr, int _start, int _nbits, int *_result)
234 if (_nbits > 0) {
236 _stopbitstr = _bitstr + _bit_idx(_nbits - 1);
246 if (_offset == 0 || _value >= _nbits)
256 bit_ffs(bitstr_t *_bitstr, int _nbits, int *_result)
258 bit_ffs_at(_bitstr, /*start*/0, _nbits, _result);
263 bit_ffc(bitstr_t *_bitstr, int _nbits, int *_result)
265 bit_ffc_at(_bitstr, /*start*/0, _nbits, _result);
268 /* Count the number of bits set in a bitstr of size _nbits at or after _start */
270 bit_count(bitstr_t *_bitstr, int _start, int _nbits, int *_result)
275 if (_start >= _nbits)
279 _nbits -= _BITSTR_BITS * _bit_idx(_start);
283 curbitstr_len = (int)_BITSTR_BITS < _nbits ?
284 (int)_BITSTR_BITS : _nbits;
288 _nbits -= _BITSTR_BITS;
290 while (_nbits >= (int)_BITSTR_BITS) {
293 _nbits -= _BITSTR_BITS;
295 if (_nbits > 0) {
296 mask = _bit_make_mask(0, _bit_offset(_nbits - 1));