|
3 | 3 |
|
4 | 4 | use crate::ByteOrder; |
5 | 5 | use bigint::{ |
6 | | - ArrayEncoding, ByteArray, Integer, Invert, Odd, PrecomputeInverter, Uint, |
| 6 | + ArrayEncoding, ByteArray, Integer, Invert, Uint, |
7 | 7 | hybrid_array::{Array, ArraySize, typenum::Unsigned}, |
8 | | - modular::{ |
9 | | - ConstMontyForm as MontyForm, ConstMontyFormInverter, ConstMontyParams, SafeGcdInverter, |
10 | | - }, |
| 8 | + modular::{ConstMontyForm as MontyForm, ConstMontyFormInverter, ConstMontyParams}, |
11 | 9 | }; |
12 | 10 | use core::fmt::Formatter; |
13 | 11 | use core::{ |
@@ -325,20 +323,14 @@ impl<MOD: MontyFieldParams<LIMBS>, const LIMBS: usize> MontyFieldElement<MOD, LI |
325 | 323 |
|
326 | 324 | /// Compute field inversion: `1 / self`. |
327 | 325 | #[inline] |
328 | | - pub fn invert(&self) -> CtOption<Self> |
329 | | - where |
330 | | - MontyForm<MOD, LIMBS>: Invert<Output = CtOption<MontyForm<MOD, LIMBS>>>, |
331 | | - { |
332 | | - self.0.invert().map(Self) |
| 326 | + pub fn invert(&self) -> CtOption<Self> { |
| 327 | + CtOption::from(self.0.invert()).map(Self) |
333 | 328 | } |
334 | 329 |
|
335 | 330 | /// Compute field inversion as a `const fn`. Panics if `self` is zero. |
336 | 331 | /// |
337 | 332 | /// This is mainly intended for inverting constants at compile time. |
338 | | - pub const fn const_invert<const UNSAT_LIMBS: usize>(&self) -> Self |
339 | | - where |
340 | | - Odd<Uint<LIMBS>>: PrecomputeInverter<Inverter = SafeGcdInverter<LIMBS, UNSAT_LIMBS>, Output = Uint<LIMBS>>, |
341 | | - { |
| 333 | + pub const fn const_invert(&self) -> Self { |
342 | 334 | Self( |
343 | 335 | ConstMontyFormInverter::<MOD, LIMBS>::new() |
344 | 336 | .invert(&self.0) |
@@ -377,13 +369,10 @@ impl<MOD: MontyFieldParams<LIMBS>, const LIMBS: usize> MontyFieldElement<MOD, LI |
377 | 369 | // `ff` crate trait impls |
378 | 370 | // |
379 | 371 |
|
380 | | -impl<MOD: MontyFieldParams<LIMBS>, const LIMBS: usize, const UNSAT_LIMBS: usize> Field |
381 | | - for MontyFieldElement<MOD, LIMBS> |
| 372 | +impl<MOD: MontyFieldParams<LIMBS>, const LIMBS: usize> Field for MontyFieldElement<MOD, LIMBS> |
382 | 373 | where |
383 | 374 | Array<u8, MOD::ByteSize>: Copy, |
384 | 375 | Uint<LIMBS>: ArrayEncoding, |
385 | | - Odd<Uint<LIMBS>>: |
386 | | - PrecomputeInverter<Inverter = SafeGcdInverter<LIMBS, UNSAT_LIMBS>, Output = Uint<LIMBS>>, |
387 | 376 | { |
388 | 377 | const ZERO: Self = Self::ZERO; |
389 | 378 | const ONE: Self = Self::ONE; |
@@ -424,13 +413,10 @@ where |
424 | 413 | } |
425 | 414 | } |
426 | 415 |
|
427 | | -impl<MOD: MontyFieldParams<LIMBS>, const LIMBS: usize, const UNSAT_LIMBS: usize> PrimeField |
428 | | - for MontyFieldElement<MOD, LIMBS> |
| 416 | +impl<MOD: MontyFieldParams<LIMBS>, const LIMBS: usize> PrimeField for MontyFieldElement<MOD, LIMBS> |
429 | 417 | where |
430 | 418 | Array<u8, MOD::ByteSize>: Copy, |
431 | 419 | Uint<LIMBS>: ArrayEncoding, |
432 | | - Odd<Uint<LIMBS>>: |
433 | | - PrecomputeInverter<Inverter = SafeGcdInverter<LIMBS, UNSAT_LIMBS>, Output = Uint<LIMBS>>, |
434 | 420 | { |
435 | 421 | type Repr = Array<u8, MOD::ByteSize>; |
436 | 422 |
|
|
0 commit comments