DIAMOND JEFF <[EMAIL PROTECTED]> wrote:
> To create a value 2^k, you can just say (1 << k).
(Which IIRC isn't constant time on a DragonBall, btw.)
> I need the inverse function.
>
> Given a value 2 ^ k, does anyone know how to efficiently extract k
> (other than a shift loop?)
Use a hash table. n % 19 has no collisions on { 2^k: 0 <= k < 16 },
and n % 37 similarly for 0 <= k < 32.
John
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/