📅  最后修改于: 2022-03-11 14:44:46.902000             🧑  作者: Mango
//C++ Code to find the value of 2^n = highestOneBit().
int highestOneBit(int i) {
i |= (i >> 1);
i |= (i >> 2);
i |= (i >> 4);
i |= (i >> 8);
i |= (i >> 16);
return i - (i >> 1);
}