From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 11 14:59:13 2015 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6331197B; Thu, 11 Jun 2015 14:59:13 +0000 (UTC) (envelope-from ryao@gentoo.org) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 452F815BE; Thu, 11 Jun 2015 14:59:12 +0000 (UTC) (envelope-from ryao@gentoo.org) Received: from [192.168.1.2] (pool-72-89-250-199.nycmny.fios.verizon.net [72.89.250.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ryao) by smtp.gentoo.org (Postfix) with ESMTPSA id 7F122340C3E; Thu, 11 Jun 2015 14:59:11 +0000 (UTC) Message-ID: <5579A235.80609@gentoo.org> Date: Thu, 11 Jun 2015 10:59:01 -0400 From: Richard Yao User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Ian Lepore CC: Erich Dollansky , "freebsd-hackers@freebsd.org" Subject: Re: allow ffs & co. a binary search References: <20150607081315.7c0f09fb@B85M-HD3-0.alogt.com> <5579A016.4040800@gentoo.org> <1434034373.1415.3.camel@freebsd.org> In-Reply-To: <1434034373.1415.3.camel@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UUSBrl9GXVe8oukFULg4KtKwCTV90NbEi" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jun 2015 14:59:13 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --UUSBrl9GXVe8oukFULg4KtKwCTV90NbEi Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 06/11/2015 10:52 AM, Ian Lepore wrote: > On Thu, 2015-06-11 at 10:49 -0400, Richard Yao wrote: >> On 06/06/2015 08:13 PM, Erich Dollansky wrote: > [...] >> >> The fastest portable way of calculating highest bit set is to use a >> debrujin sequence: >> >> https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruij= n >> >> The binary approach is inferior, especially on Pentium 4 processors. >=20 > And of course it's crucial that we optimize for Pentium 4 processors in= > 2015. The debrujin approach is fast regardless of the architecture. Anyway, this is a solved problem. There is no need to reinvent the wheel when the portable solutions are listed on that page at Stanford. --UUSBrl9GXVe8oukFULg4KtKwCTV90NbEi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVeaI6AAoJECDuEZm+6Exk9AgQAJfN9OjSLJyOQF+HSRWfjXRw Nz3eX1Hn83PrjvJUUFBxDFqTQQYycjgAAk/vbqCuy/hflRakdlAclXuP+ZiW6y5C eMo9sV8LtaBFqZ45ACrRCFno/gSEq/OWgSa7/EhBiRHBfu0k0x8xJbZMdT1ZPzQM yGG4+DIBQtXj42KzKjYIXs3QRepff3qMXAi/78ksmd5PZ7jNa1x1LTe+qZJP4hUC OJ/2XR6VRD/fLXGzfxgAjZS9Y1f2mno1oxPm91CntnpLPAyBVR/CWCBeCUADcM0E nycezA5h0pUU/53ayWe+TUc9dmKEBQ4SKXdi1PBGK4mBzoDvesQDV9aEq8ujTR3x eHxAOA897No5MrpFBCbE5MwDLYcZFoWY9owBYIuHXCIKBFfXr+GXu7pY6dGIvEKg p8GUk84Y+cvHLSzXbZHJru8YCKUBLsgUMZCKwLMHqeTCLa3oW455hFjombtvVwJ7 FuQV10+BZ8exI14SeyyZfrQJnPeLhS//HWobYq6AL9xLDVmXVf9qP3+U6g8eisyo xHBOL6ZhEHHyIiLISJL4YYAyZzk3Sr843FuEfIr+j6dqO6wlBmuWY3NlsiL3lotN Mb3lorTn4j4LOth3R8C/S5rfWgqpYUXzN77rGUunXcQU4u3Q6fxLp4HpQyK8+CdG /xZwTAbNIawevTIUViey =oPoC -----END PGP SIGNATURE----- --UUSBrl9GXVe8oukFULg4KtKwCTV90NbEi--