mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Remove comment, simplify if.
This commit is contained in:
parent
062dc9473e
commit
bb4def62df
1 changed files with 2 additions and 3 deletions
|
|
@ -24,9 +24,9 @@ pub fn egcd(a: anytype, b: anytype) ExtendedGreatestCommonDivisor(@TypeOf(a, b))
|
|||
},
|
||||
else => |T| T,
|
||||
};
|
||||
if (@typeInfo(S) != .int or @typeInfo(S).int.signedness != .signed) {
|
||||
|
||||
if (@typeInfo(S) != .int or @typeInfo(S).int.signedness != .signed)
|
||||
@compileError("`a` and `b` must be signed integers");
|
||||
}
|
||||
|
||||
std.debug.assert(a != 0 or b != 0);
|
||||
|
||||
|
|
@ -169,7 +169,6 @@ test {
|
|||
const b: i4 = 5;
|
||||
const r = egcd(a, b);
|
||||
const g = r.gcd;
|
||||
// Avoid overflow in assert.
|
||||
const s: i8 = r.bezout_coeff_1;
|
||||
const t: i8 = r.bezout_coeff_2;
|
||||
try std.testing.expect(s * a + t * b == g);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue