@@ -92,9 +92,9 @@ test powMod {
9292/// - $O(\log m)$
9393pub fn invMod (x : i64 , m : i64 ) i64 {
9494 assert (1 <= m );
95- const z = internal .invGcd (x , m );
96- assert (z .@ "0" == 1 );
97- return z .@ "1" ;
95+ const z0 , const z1 = internal .invGcd (x , m );
96+ assert (z0 == 1 );
97+ return z1 ;
9898}
9999
100100test invMod {
@@ -165,9 +165,7 @@ pub fn crt(r: []const i64, m: []const i64) struct { i64, i64 } {
165165 // -> x = (ri - r0) / g * inv(u0) (mod u1)
166166
167167 // im = inv(u0) (mod u1) (0 <= im < u1)
168- const gim = internal .invGcd (m0 , mi );
169- const g = gim .@"0" ;
170- const im = gim .@"1" ;
168+ const g , const im = internal .invGcd (m0 , mi );
171169 const ui = @divFloor (mi , g );
172170 // |ri - r0| < (m0 + mi) <= lcm(m0, mi)
173171 if (@mod (ri - r0 , g ) != 0 ) {
@@ -210,11 +208,11 @@ test crt {
210208 };
211209
212210 for (tests ) | t | {
213- const expected = t .expected ;
214- const result = crt (t .a , t .b );
211+ const expected_a , const expected_b = t .expected ;
212+ const result_a , const result_b = crt (t .a , t .b );
215213
216- try std .testing .expectEqual (expected .@ "0" , result .@ "0" );
217- try std .testing .expectEqual (expected .@ "1" , result .@ "1" );
214+ try std .testing .expectEqual (expected_a , result_a );
215+ try std .testing .expectEqual (expected_b , result_b );
218216 }
219217}
220218
0 commit comments