On Monday, May 23, 2016 08:29:18 PM Alan Somers wrote: > Author: asomers > Date: Mon May 23 20:29:18 2016 > New Revision: 300539 > URL: https://svnweb.freebsd.org/changeset/base/300539 > > Log: > Add bit_count to the bitstring(3) api >
(My aplogies, I replied to the wrong commit.)
This breaks i386:
In file included from /usr/src/usr.sbin/apmd/apmd.c:36:
In file included from /usr/obj/usr/src/tmp/usr/include/bitstring.h:34:
/usr/obj/usr/src/tmp/usr/include/sys/bitstring.h:278:13: error: implicit
declaration of function '__bitcountl' is invalid in C99 [-Werror,-Wimplicit-
function-declaration]
_value += __bitcountl(*_curbitstr & mask);
...
This is coming from the inline below:
> @@ -256,4 +257,40 @@ bit_ffc(bitstr_t *_bitstr, int _nbits, i
> bit_ffc_at(_bitstr, /*start*/0, _nbits, _result);
> }
>
> +/* Count the number of bits set in a bitstr of size _nbits at or after
> _start */ +static inline void
> +bit_count(bitstr_t *_bitstr, int _start, int _nbits, int *_result)
> +{
> + bitstr_t *_curbitstr, mask;
> + int _value = 0, curbitstr_len;
> +
> + if (_start >= _nbits)
> + goto out;
> +
> + _curbitstr = _bitstr + _bit_idx(_start);
> + _nbits -= _BITSTR_BITS * _bit_idx(_start);
> + _start -= _BITSTR_BITS * _bit_idx(_start);
> +
> + if (_start > 0) {
> + curbitstr_len = (int)_BITSTR_BITS < _nbits ?
> + (int)_BITSTR_BITS : _nbits;
> + mask = _bit_make_mask(_start, _bit_offset(curbitstr_len - 1));
> + _value += __bitcountl(*_curbitstr & mask);
> + _curbitstr++;
> + _nbits -= _BITSTR_BITS;
> + }
> + while (_nbits >= (int)_BITSTR_BITS) {
> + _value += __bitcountl(*_curbitstr);
> + _curbitstr++;
> + _nbits -= _BITSTR_BITS;
> + }
> + if (_nbits > 0) {
> + mask = _bit_make_mask(0, _bit_offset(_nbits - 1));
> + _value += __bitcountl(*_curbitstr & mask);
> + }
> +
> +out:
> + *_result = _value;
> +}
--
Peter Wemm - [email protected]; [email protected]; [email protected]; KI6FJV
UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246
signature.asc
Description: This is a digitally signed message part.
