mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Inline Fe.{sub,mul,sq} for a performance boost in release-safe mode
This commit is contained in:
parent
ab6ffa8a3c
commit
37ae246405
@ -114,7 +114,7 @@ pub const Fe = struct {
|
||||
return fe;
|
||||
}
|
||||
|
||||
pub fn sub(a: Fe, b: Fe) Fe {
|
||||
pub inline fn sub(a: Fe, b: Fe) Fe {
|
||||
var fe = b;
|
||||
comptime var i = 0;
|
||||
inline while (i < 4) : (i += 1) {
|
||||
@ -200,7 +200,7 @@ pub const Fe = struct {
|
||||
return .{ .limbs = rs };
|
||||
}
|
||||
|
||||
pub fn mul(a: Fe, b: Fe) Fe {
|
||||
pub inline fn mul(a: Fe, b: Fe) Fe {
|
||||
var ax: [5]u128 = undefined;
|
||||
var bx: [5]u128 = undefined;
|
||||
var a19: [5]u128 = undefined;
|
||||
@ -223,7 +223,7 @@ pub const Fe = struct {
|
||||
return _carry128(&r);
|
||||
}
|
||||
|
||||
fn _sq(a: Fe, double: comptime bool) Fe {
|
||||
inline fn _sq(a: Fe, double: comptime bool) Fe {
|
||||
var ax: [5]u128 = undefined;
|
||||
var r: [5]u128 = undefined;
|
||||
comptime var i = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user