zkp-u256 0.2.1

Performant implementation of 256-bit unsigned integers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mod knuth_division;
mod lehmer_gcd;

use crate::U256;

pub(crate) use knuth_division::{divrem_nby1, divrem_nbym};
pub(crate) use lehmer_gcd::{gcd, gcd_extended, inv_mod};

/// Reduce at most once
#[inline(always)]
pub(crate) fn reduce_1(s: &U256, modulus: &U256) -> U256 {
    if s >= modulus {
        s - modulus
    } else {
        s.clone()
    }
}