Efficient way to manipulate large powers of two
Posted
by bguiz
on Stack Overflow
See other posts from Stack Overflow
or by bguiz
Published on 2010-05-08T02:19:05Z
Indexed on
2010/05/08
2:28 UTC
Read the original article
Hit count: 314
The most efficient way to code powers of two is by bit shifting of integers.
1 << n
gives me 2^(n-1)
However, if I have a number that is larger than the largest value allowed in an int
, what can I use to efficiently manipulate powers of 2?
© Stack Overflow or respective owner