fix overflow: if (1 << (sizeof(int)*8 - 1)) - 1 is INT_MAX, then obviously 1 << (sizeof(int)*8 - 1)) overflows (it is INT_MAX+1)