/*************************************************
* Name: montgomery_reduce
*
* Description: For finite field element a with -2^{31}Q <= a <= Q*2^31,
* compute r \equiv a*2^{-32} (mod Q) such that -Q < r < Q.
*
* Arguments: - int64_t: finite field element a
*
* Returns r.
**************************************************/
The upper bound of the input range is off by 1, since montgomery_reduce(Q*2^31) == Q. The lower bound is okay.
The correct input range is -2^{31}Q <= a < Q*2^31.
The upper bound of the input range is off by 1, since
montgomery_reduce(Q*2^31) == Q. The lower bound is okay.The correct input range is
-2^{31}Q <= a < Q*2^31.