From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 11 14:52:55 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBD10456 for ; Thu, 11 Jun 2015 14:52:55 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery4.ore.mailhop.org (pmta2.delivery4.ore.mailhop.org [54.200.247.200]) by mx1.freebsd.org (Postfix) with SMTP id AB097151D for ; Thu, 11 Jun 2015 14:52:55 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Thu, 11 Jun 2015 14:52:54 +0000 (UTC) Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t5BEqrVX006682; Thu, 11 Jun 2015 08:52:53 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1434034373.1415.3.camel@freebsd.org> Subject: Re: allow ffs & co. a binary search From: Ian Lepore To: Richard Yao Cc: Erich Dollansky , "freebsd-hackers@freebsd.org" Date: Thu, 11 Jun 2015 08:52:53 -0600 In-Reply-To: <5579A016.4040800@gentoo.org> References: <20150607081315.7c0f09fb@B85M-HD3-0.alogt.com> <5579A016.4040800@gentoo.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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:52:55 -0000 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#IntegerLogDeBruijn > > The binary approach is inferior, especially on Pentium 4 processors. And of course it's crucial that we optimize for Pentium 4 processors in 2015. -- Ian