"Daniel C. Sobral" <d...@newsguy.com> wrote > 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.
Counting n as bit, it is O(n) :p Unrolling the loop, if(n<=2^0) 2^0 else if(n<=2^1) 2^1 else if(n<=2^2) 2^2 else if(n<=2^3) 2^3 : : else if(n<=2^31) 2^31 is suitable for this problem? --- //mit To Unsubscribe: send mail to majord...@freebsd.org with "unsubscribe freebsd-hackers" in the body of the message