Date: Sun, 22 Aug 1999 15:32:25 +0200 (CEST) From: Nick Hibma <n_hibma@skylink.it> To: Peter Dufault <dufault@hda.com> Cc: hackers@FreeBSD.ORG Subject: Re: from number to power of two Message-ID: <Pine.BSF.4.10.9908221531560.7595-100000@heidi.plazza.it> In-Reply-To: <199908221314.JAA18225@hda.hda.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Unfortunately the kernel is compiled with -O which does not include inlining (dunno about explicit inlining, but don't think so). Nick On Sun, 22 Aug 1999, Peter Dufault wrote: > > It seems that all the solutions are too generic and slow. As I only have > > to check the numbers 0-32 (actually 1-32), a block of if statements is > > almost as fast as a table look up in 33 elements. > > I doubt it - use the table for a small fixed size set then > use Warner's "(n) ? (1 << (ffs(n) - 1)) : 0". > The possible inline ffs is in machine/cpufunc.h > > ffs() is fundamental to scheduling queues and cryptography and > should have attention paid to it. As Warner said, it could be > a single instruction on some architectures. > > Peter > > -- > Peter Dufault (dufault@hda.com) Realtime development, Machine control, > HD Associates, Inc. Safety critical systems, Agency approval > > -- e-Mail: hibma@skylink.it To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9908221531560.7595-100000>