Previous power of 2

Posted by Horacio on Stack Overflow See other posts from Stack Overflow or by Horacio
Published on 2010-04-21T01:50:50Z Indexed on 2010/04/21 1:53 UTC
Read the original article Hit count: 380

Filed under:

There is a lot of information on how to find the next power of 2 of a given value (see refs) but I cannot find any to get the previous power of two.

The only way I find so far is to keep a table with all power of two up to 2^64 and make a simple lookup.

© Stack Overflow or respective owner

Related posts about power