Update Pk.cpp

(~low % 2) might return -1, whereas (~low & 1) returns 0 or 1