From owner-svn-src-all@FreeBSD.ORG Thu Dec 4 00:54:53 2014 Return-Path: Delivered-To: svn-src-all@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 8E5BE3B3; Thu, 4 Dec 2014 00:54:53 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B8619B5; Thu, 4 Dec 2014 00:54:52 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id sB40spIH013525 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Dec 2014 16:54:52 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id sB40spNW013524; Wed, 3 Dec 2014 16:54:51 -0800 (PST) (envelope-from jmg) Date: Wed, 3 Dec 2014 16:54:51 -0800 From: John-Mark Gurney To: Hans Petter Selasky Subject: Re: svn commit: r275468 - head/sys/dev/usb/controller Message-ID: <20141204005451.GM99957@funkthat.com> References: <201412032155.sB3LtjJN043364@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201412032155.sB3LtjJN043364@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Wed, 03 Dec 2014 16:54:52 -0800 (PST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 00:54:53 -0000 Hans Petter Selasky wrote this message on Wed, Dec 03, 2014 at 21:55 +0000: > Author: hselasky > Date: Wed Dec 3 21:55:44 2014 > New Revision: 275468 > URL: https://svnweb.freebsd.org/changeset/base/275468 > > Log: > Optimise the bit searching loops, by quickly skipping the 16 first set > bits if all the 16 first bits are set. This way the worst case > searching time is reduced from 32 to 16 cycles. You could use ffs instead: x = ffs(~map); if (x) { x--; /* normal code */ } This has the benefit of using a single instruction on platforms that support it (bsfl on i386), though apparently, we haven't optimized this for all platforms... arm has a version for int, but their ffsl does the same linear search instead of just calling ffs, or at least detecting if sizeof(long) == sizeof(int) and calling ffs... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."