@@ -73,12 +73,9 @@ pub const NonMontgomeryDomainFieldElement = [4]u64;
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0x1]
inline fn addcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
@setRuntimeSafety(mode == .Debug);
const ov1 = @addWithOverflow(arg2, arg3);
const ov2 = @addWithOverflow(ov1[0], arg1);
out1.* = ov2[0];
out2.* = ov1[1] | ov2[1];
const x = @as(u128, arg2) +% arg3 +% arg1;
out1.* = @truncate(x);
out2.* = @truncate(x >> 64);
}
/// The function subborrowxU64 is a subtraction with borrow.
@@ -95,12 +92,9 @@ inline fn addcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) vo
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0x1]
inline fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
@setRuntimeSafety(mode == .Debug);
const ov1 = @subWithOverflow(arg2, arg3);
const ov2 = @subWithOverflow(ov1[0], arg1);
out1.* = ov2[0];
out2.* = ov1[1] | ov2[1];
const x = @as(u128, arg2) -% arg3 -% arg1;
out1.* = @truncate(x);
out2.* = @truncate(x >> 64);
}
/// The function mulxU64 is a multiplication, returning the full double-width result.