John-Mark Gurney wrote:
>
> > Shift a bit until it becomes greater than (or less than) the number
> > in question.
>
> ummm, didn't you read his post?? he wanted a O(1) routine, NOT a O(n)
> routine...
That technique is O(ln(n)), where n is the number in question.
Frankly, for numbers up to 32, a table will wield the best results,
and might actually be smaller than some of the suggestions given so
far.
--
Daniel C. Sobral (8-DCS)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
- Come on.
- Where are we going?
- To get what you came for.
- What's that?
- Me.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message
- from number to power of two Nick Hibma
- Re: from number to power of two Leigh Hart
- Re: from number to power of two Luigi Rizzo
- Re: from number to power of two Patryk Zadarnowski
- Re: from number to power of two Johan Karlsson
- RE: from number to power of two Don Read
- Re: from number to power of two Warner Losh
- Re: from number to power of two John-Mark Gurney
- Re: from number to power of two Mark Murray
- Re: from number to power of two John-Mark Gurney
- Re: from number to power of two Daniel C. Sobral
- Re: from number to power of two Kazufumi-MIT-Mitani
- Re: from number to power of two Nick Hibma
- Re: from number to power of two Peter Dufault
- Re: from number to power of two Nick Hibma
- Re: from number to power of two Brian F. Feldman
- Re: from number to power of ... Ollivier Robert
- Re: from number to power of two Peter Wemm
- Re: from number to power of two Tommy Hallgren
- Re: from number to power of two Bakul Shah

