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)
d...@newsguy.com
d...@freebsd.org

        - Come on.
        - Where are we going?
        - To get what you came for.
        - What's that?
        - Me.


To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to