http://graphics.stanford.edu/~seander/bithacks.html