APInt has a method for determining whether a number is a power of 2