@@ -142,6 +142,7 @@ impl<const SAT_LIMBS: usize, const UNSAT_LIMBS: usize> Inverter
142142
143143/// Returns the multiplicative inverse of the argument modulo 2^62. The implementation is based
144144/// on the Hurchalla's method for computing the multiplicative inverse modulo a power of two.
145+ ///
145146/// For better understanding the implementation, the following paper is recommended:
146147/// J. Hurchalla, "An Improved Integer Multiplicative Inverse (modulo 2^w)",
147148/// https://arxiv.org/pdf/2204.04342.pdf
@@ -238,8 +239,9 @@ const fn jump(f: &[u64], g: &[u64], mut delta: i64) -> (i64, Matrix) {
238239}
239240
240241/// Returns the updated values of the variables f and g for specified initial ones and
241- /// Bernstein-Yang transition matrix multiplied by 2^62. The returned vector is
242- /// "matrix * (f, g)' / 2^62", where "'" is the transpose operator.
242+ /// Bernstein-Yang transition matrix multiplied by 2^62.
243+ ///
244+ /// The returned vector is "matrix * (f, g)' / 2^62", where "'" is the transpose operator.
243245const fn fg < const LIMBS : usize > (
244246 f : Int62L < LIMBS > ,
245247 g : Int62L < LIMBS > ,
@@ -252,10 +254,12 @@ const fn fg<const LIMBS: usize>(
252254}
253255
254256/// Returns the updated values of the variables d and e for specified initial ones and
255- /// Bernstein-Yang transition matrix multiplied by 2^62. The returned vector is congruent modulo
256- /// M to "matrix * (d, e)' / 2^62 (mod M)", where M is the modulus the inverter was created for
257- /// and "'" stands for the transpose operator. Both the input and output values lie in the
258- /// interval (-2 * M, M).
257+ /// Bernstein-Yang transition matrix multiplied by 2^62.
258+ ///
259+ /// The returned vector is congruent modulo M to "matrix * (d, e)' / 2^62 (mod M)", where M is the
260+ /// modulus the inverter was created for and "'" stands for the transpose operator.
261+ ///
262+ /// Both the input and output values lie in the interval (-2 * M, M).
259263const fn de < const LIMBS : usize > (
260264 modulus : & Int62L < LIMBS > ,
261265 inverse : i64 ,
@@ -313,7 +317,7 @@ impl<const LIMBS: usize> Int62L<LIMBS> {
313317 ret
314318 } ;
315319
316- /// Convert from 64-bit saturated representation used by `Uint` to the 62-bit unsaturated
320+ /// Convert from 32/ 64-bit saturated representation used by `Uint` to the 62-bit unsaturated
317321 /// representation used by `Int62L`.
318322 ///
319323 /// Returns a big unsigned integer as an array of 62-bit chunks, which is equal modulo
@@ -332,13 +336,13 @@ impl<const LIMBS: usize> Int62L<LIMBS> {
332336 Self ( output)
333337 }
334338
335- /// Convert from 62-bit unsaturated representation used by `Int62L` to the 64-bit saturated
339+ /// Convert from 62-bit unsaturated representation used by `Int62L` to the 32/ 64-bit saturated
336340 /// representation used by `Uint`.
337341 ///
338- /// Returns a big unsigned integer as an array of 64-bit chunks, which is equal modulo
342+ /// Returns a big unsigned integer as an array of 32/ 64-bit chunks, which is equal modulo
339343 /// 2 ^ (64 * S) to the input big unsigned integer stored as an array of 62-bit chunks.
340344 ///
341- /// The ordering of the chunks in these arrays is little-endian
345+ /// The ordering of the chunks in these arrays is little-endian.
342346 #[ allow( trivial_numeric_casts, clippy:: wrong_self_convention) ]
343347 pub const fn to_uint < const SAT_LIMBS : usize > ( & self ) -> Uint < SAT_LIMBS > {
344348 debug_assert ! ( !self . is_negative( ) , "can't convert negative number to Uint" ) ;
0 commit comments