Skip to content

Commit ac10d33

Browse files
authored
Xgcd trait (#855)
This PR - transitions `Gcd for Uint/Int` from `safegcd` to `bingcd` - introduces the `Xgcd` trait, and - implements the `Xgcd for Uint/Int`.
1 parent 3b47a8a commit ac10d33

File tree

21 files changed

+1155
-1092
lines changed

21 files changed

+1155
-1092
lines changed

benches/uint.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use criterion::{
44
};
55
use crypto_bigint::modular::SafeGcdInverter;
66
use crypto_bigint::{
7-
Limb, NonZero, Odd, OddUint, PrecomputeInverter, Random, RandomBits, RandomMod, Reciprocal,
8-
U128, U256, U512, U1024, U2048, U4096, Uint,
7+
Gcd, Limb, NonZero, Odd, OddUint, PrecomputeInverter, Random, RandomBits, RandomMod,
8+
Reciprocal, U128, U256, U512, U1024, U2048, U4096, Uint,
99
};
1010
use rand_chacha::ChaCha8Rng;
1111
use rand_core::{RngCore, SeedableRng};
@@ -383,19 +383,6 @@ fn gcd_bench<const LIMBS: usize, const UNSAT_LIMBS: usize>(
383383
)
384384
});
385385

386-
g.bench_function(BenchmarkId::new("bingcd", LIMBS), |b| {
387-
b.iter_batched(
388-
|| {
389-
(
390-
Uint::<LIMBS>::random(&mut rng),
391-
Uint::<LIMBS>::random(&mut rng),
392-
)
393-
},
394-
|(f, g)| black_box(Uint::bingcd(&f, &g)),
395-
BatchSize::SmallInput,
396-
)
397-
});
398-
399386
g.bench_function(BenchmarkId::new("bingcd (classic)", LIMBS), |b| {
400387
b.iter_batched(
401388
|| {

src/int.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use crate::Encoding;
1212
use crate::{Bounded, ConstChoice, ConstCtOption, Constants, Limb, NonZero, Odd, Uint, Word};
1313

1414
mod add;
15-
mod bingcd;
1615
mod bit_and;
1716
mod bit_not;
1817
mod bit_or;

0 commit comments

Comments
 (0)