mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Rename result type
This commit is contained in:
parent
16cf4b0dc6
commit
564b7a1b3a
1 changed files with 2 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
|
|
||||||
/// Result type of `egcd`.
|
/// Result type of `egcd`.
|
||||||
pub fn ExtendedGreatestCommonDivisor(S: anytype) type {
|
pub fn Result(S: anytype) type {
|
||||||
const N = switch (S) {
|
const N = switch (S) {
|
||||||
comptime_int => comptime_int,
|
comptime_int => comptime_int,
|
||||||
else => |T| std.meta.Int(.unsigned, @bitSizeOf(T)),
|
else => |T| std.meta.Int(.unsigned, @bitSizeOf(T)),
|
||||||
|
|
@ -16,7 +16,7 @@ pub fn ExtendedGreatestCommonDivisor(S: anytype) type {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the Extended Greatest Common Divisor (EGCD) of two signed integers (`a` and `b`) which are not both zero.
|
/// Returns the Extended Greatest Common Divisor (EGCD) of two signed integers (`a` and `b`) which are not both zero.
|
||||||
pub fn egcd(a: anytype, b: anytype) ExtendedGreatestCommonDivisor(@TypeOf(a, b)) {
|
pub fn egcd(a: anytype, b: anytype) Result(@TypeOf(a, b)) {
|
||||||
const S = switch (@TypeOf(a, b)) {
|
const S = switch (@TypeOf(a, b)) {
|
||||||
comptime_int => b: {
|
comptime_int => b: {
|
||||||
const n = @max(@abs(a), @abs(b));
|
const n = @max(@abs(a), @abs(b));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue