add some bit tricks

find the greatest power of 2 <= x and the least power of 2 >= x