Date: Mon, 23 May 2016 15:31:28 -0700 From: Peter Wemm <peter@wemm.org> To: Alan Somers <asomers@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300539 - in head: . share/man/man3 sys/kern sys/sys tests/sys/sys Message-ID: <1554849.4hxx0PqhhX@overcee.wemm.org> In-Reply-To: <201605232029.u4NKTIjK072941@repo.freebsd.org> References: <201605232029.u4NKTIjK072941@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart1508528.SQmjUx9Luv Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" 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 >=20 > Log: > Add bit_count to the bitstring(3) api >=20 (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: implici= t=20 declaration of function '__bitcountl' is invalid in C99 [-Werror,-Wimpl= icit- function-declaration] _value +=3D __bitcountl(*_curbitstr & mask); ... This is coming from the inline below: > @@ -256,4 +257,40 @@ bit_ffc(bitstr_t *_bitstr, int _nbits, i > =09bit_ffc_at(_bitstr, /*start*/0, _nbits, _result); > } >=20 > +/* Count the number of bits set in a bitstr of size _nbits at or aft= er > _start */ +static inline void > +bit_count(bitstr_t *_bitstr, int _start, int _nbits, int *_result) > +{ > +=09bitstr_t *_curbitstr, mask; > +=09int _value =3D 0, curbitstr_len; > + > +=09if (_start >=3D _nbits) > +=09=09goto out; > + > +=09_curbitstr =3D _bitstr + _bit_idx(_start); > +=09_nbits -=3D _BITSTR_BITS * _bit_idx(_start); > +=09_start -=3D _BITSTR_BITS * _bit_idx(_start); > + > +=09if (_start > 0) { > +=09=09curbitstr_len =3D (int)_BITSTR_BITS < _nbits ? > +=09=09=09=09(int)_BITSTR_BITS : _nbits; > +=09=09mask =3D _bit_make_mask(_start, _bit_offset(curbitstr_len - 1)= ); > +=09=09_value +=3D __bitcountl(*_curbitstr & mask); > +=09=09_curbitstr++; > +=09=09_nbits -=3D _BITSTR_BITS; > +=09} > +=09while (_nbits >=3D (int)_BITSTR_BITS) { > +=09=09_value +=3D __bitcountl(*_curbitstr); > +=09=09_curbitstr++; > +=09=09_nbits -=3D _BITSTR_BITS; > +=09} > +=09if (_nbits > 0) { > +=09=09mask =3D _bit_make_mask(0, _bit_offset(_nbits - 1)); > +=09=09_value +=3D __bitcountl(*_curbitstr & mask); > +=09} > + > +out: > +=09*_result =3D _value; > +} =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart1508528.SQmjUx9Luv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXQ4TAAAoJEDXWlwnsgJ4E+dwIANI2Tq8KFlSlsAffqN5BIj3N tpNOYrz2TEQ+Ix/30b7CKhOUC0Q+RHEvX2J8UPEYOCIrVvIxlk1sEZfqp2JCfgzt eaU2ynhVypjSIItBaT8ClHypFBgYjTiPclc0Km7e0FV8Ueq4wP5RCC8Yll5aDMMJ vgmnEbszdOG6sNlOqWTthe+5hdSgCt+eAntiLH5I3NroQSjiEy/skLV9gMvqAGZA U1Np7j8+9UQ4FEMhJLqBNH6idOChlZ4iT4EDT7if5SEHuh52RrNeMta/AM5EcfEd QZcrGbJayT9UwcMK6XL1S6bxfIim7EcW2KOGlQMrYnooBNMkS33hhhYOU/dEm8s= =6uJL -----END PGP SIGNATURE----- --nextPart1508528.SQmjUx9Luv--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1554849.4hxx0PqhhX>