fix testBit for negative numbers