Slight speedup of sqrtmod functions.