Note then that if we have a string D of 2d bits and we want to evaluate D = D mod P , then we can write
D = D1 × 2d + D2, where D1 and D2 are the leftmost, respectively rightmost d bits of D. We get that D = D1 × 2d + D2 =
D1 × C + D2, where C = 2d mod P is a constant that can be pre-computed.