Try fixing test failures on Windows:

Avoid relying on overflows w.r.t. sys.maxint.