@@ -22,19 +22,20 @@ impl fmt::Display for QM31Error {
22
22
match self {
23
23
QM31Error :: UnreducedFelt ( felt) => write ! (
24
24
f,
25
- "Number is not a packing of a QM31 in reduced form: {felt})"
25
+ "number is not a packing of a QM31 in reduced form: {felt})"
26
26
) ,
27
27
QM31Error :: FeltTooBig ( felt) => write ! (
28
28
f,
29
- "Number used as QM31 since it's more than 144 bits long: {felt}"
29
+ "number used as QM31 since it's more than 144 bits long: {felt}"
30
30
) ,
31
- QM31Error :: InvalidInversion => write ! ( f, "Attempt to invert a qm31 equal to zero" ) ,
31
+ QM31Error :: InvalidInversion => write ! ( f, "attempt to invert a qm31 equal to zero" ) ,
32
32
}
33
33
}
34
34
}
35
35
36
- /// Definition of a Quad M31 in its reduced form. The internal representation
37
- /// is composed by the coordinates of the QM31, following a little endian ordering.
36
+ /// Definition of a Quad M31 in its reduced form.
37
+ ///
38
+ /// The internal representation is composed of the coordinates of the QM31, following a little-endian ordering.
38
39
#[ repr( transparent) ]
39
40
#[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
40
41
pub struct QM31 ( [ u64 ; 4 ] ) ;
@@ -141,8 +142,9 @@ impl QM31 {
141
142
Self :: from_coordinates ( result_coordinates)
142
143
}
143
144
144
- /// Computes the inverse in the M31 field using Fermat's little theorem, i.e., returns
145
- /// `v^(STWO_PRIME-2) modulo STWO_PRIME`, which is the inverse of v unless v % STWO_PRIME == 0.
145
+ /// Computes the inverse in the M31 field using Fermat's little theorem.
146
+ ///
147
+ /// Returns `v^(STWO_PRIME-2) modulo STWO_PRIME`, which is the inverse of v unless v % STWO_PRIME == 0.
146
148
fn m31_inverse ( v : u64 ) -> u64 {
147
149
let t0 = ( Self :: sqn ( v, 2 ) * v) % STWO_PRIME ;
148
150
let t1 = ( Self :: sqn ( t0, 1 ) * t0) % STWO_PRIME ;
0 commit comments