```
int rangeBitwiseAnd(int m, int n) {
if (m==n) return m;
else if (m==0) return 0;
int bitWise = 0, log2_m = log2(m);
while(log2_m==(int)log2(n)) {
int pow2 = pow(2, log2_m);
bitWise |= pow2;
m -= pow2;
n -= pow2;
if (m==0) break;
log2_m = log2(m);
}
return bitWise;
}
```