From owner-svn-src-head@freebsd.org Mon May 23 22:31:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77F18B478AB; Mon, 23 May 2016 22:31:29 +0000 (UTC) (envelope-from peter@wemm.org) Received: from smtp2.wemm.org (smtp2.wemm.org [IPv6:2001:470:67:39d::78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 646A51C4C; Mon, 23 May 2016 22:31:29 +0000 (UTC) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id 0DC7DEEA; Mon, 23 May 2016 15:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1464042689; bh=bQ9lw4U1CZE297HIStMo3HQLqg2E6u60OIhmL20Ukfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ILgvxYRN8S4HrKdDscYxrjmnyKzuxfVpodjebBryN8A4fFLZ9fY7XWzTkI6Fbu07m xw/t/2Z0JRKNYUu3rEsO5h71v9WCkRaTcAtB8S92GlPHznd1oZHpFElLvkXaBr2Z0X kvvz5Ulq2rimRpRbK/9PxTS3eJT6uKVdDmaqU8I4= From: Peter Wemm To: Alan Somers 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 Date: Mon, 23 May 2016 15:31:28 -0700 Message-ID: <1554849.4hxx0PqhhX@overcee.wemm.org> User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT; KDE/4.14.3; amd64; ; ) In-Reply-To: <201605232029.u4NKTIjK072941@repo.freebsd.org> References: <201605232029.u4NKTIjK072941@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1508528.SQmjUx9Luv"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 22:31:29 -0000 --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--