pub fn signed_mod_reduction(n: u64, modulus: u64) -> i64
Expand description

Compute the signed modulo operation on a u64 representation, returning the result. If n % modulus > modulus / 2, return modulus - n

Example

use ark_ff::signed_mod_reduction;
let res = signed_mod_reduction(6u64, 8u64);
assert_eq!(res, -2i64);