cute snippet for checking if a number is a power of 2:
n & n - 1 == 0 && n != 0
edited on friday march 19th, 2010 at 13:37 (PDT):
this was used fairly extensively in the typewriter project
cute snippet for checking if a number is a power of 2:
n & n - 1 == 0 && n != 0
edited on friday march 19th, 2010 at 13:37 (PDT):