home
about

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

posted on monday august 3rd, 2009 at 15:25 (PDT)