@@ -142,6 +142,7 @@ impl<const SAT_LIMBS: usize, const UNSAT_LIMBS: usize> Inverter
142
142
143
143
/// Returns the multiplicative inverse of the argument modulo 2^62. The implementation is based
144
144
/// on the Hurchalla's method for computing the multiplicative inverse modulo a power of two.
145
+ ///
145
146
/// For better understanding the implementation, the following paper is recommended:
146
147
/// J. Hurchalla, "An Improved Integer Multiplicative Inverse (modulo 2^w)",
147
148
/// https://arxiv.org/pdf/2204.04342.pdf
@@ -238,8 +239,9 @@ const fn jump(f: &[u64], g: &[u64], mut delta: i64) -> (i64, Matrix) {
238
239
}
239
240
240
241
/// 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.
243
245
const fn fg < const LIMBS : usize > (
244
246
f : Int62L < LIMBS > ,
245
247
g : Int62L < LIMBS > ,
@@ -252,10 +254,12 @@ const fn fg<const LIMBS: usize>(
252
254
}
253
255
254
256
/// 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).
259
263
const fn de < const LIMBS : usize > (
260
264
modulus : & Int62L < LIMBS > ,
261
265
inverse : i64 ,
@@ -313,7 +317,7 @@ impl<const LIMBS: usize> Int62L<LIMBS> {
313
317
ret
314
318
} ;
315
319
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
317
321
/// representation used by `Int62L`.
318
322
///
319
323
/// 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> {
332
336
Self ( output)
333
337
}
334
338
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
336
340
/// representation used by `Uint`.
337
341
///
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
339
343
/// 2 ^ (64 * S) to the input big unsigned integer stored as an array of 62-bit chunks.
340
344
///
341
- /// The ordering of the chunks in these arrays is little-endian
345
+ /// The ordering of the chunks in these arrays is little-endian.
342
346
#[ allow( trivial_numeric_casts, clippy:: wrong_self_convention) ]
343
347
pub const fn to_uint < const SAT_LIMBS : usize > ( & self ) -> Uint < SAT_LIMBS > {
344
348
debug_assert ! ( !self . is_negative( ) , "can't convert negative number to Uint" ) ;
0 commit comments