What\'s the fastest way to enumerate through an integer and return the exponent of each bit that is turned on? Have seen an example using << and another u
void func(int i, int& n, int a[]){
n = 0;
if (i < 0) a[n++] = 31;
i <<= 1;
if (i < 0) a[n++] = 30;
i <<= 1;
if (i < 0) a[n++] = 29;
i <<= 1;
...
if (i < 0) a[n++] = 0;
}