I want to be able to find the smallest power of 2 >= n.

For example:

Input: 1

Output: 1

Input: 3

Output: 4

Input: 29

Output: 32

Is there an O(1) algorithm for doing this? Otherwise, what is the fastest algorithm considering constant factors as well.