authorgravatar for 11590808+mllken@users.noreply.github.comEric Milliken <11590808+mllken@users.noreply.github.com> 2023-03-06 22:28:11+00:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-03-06 17:28:11-05:00
logccf00ccdf71fae7ecd25d9b1bf11dc7eb52d5d1d
tree6eee79237bae56c80a724812d975488eb54c2e5c
parent6ab04b59417eb9c7fff81ea26424c2340dc72097
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

crypto.25519.field: de-inline mul for small builds (#14775)


1 files changed, 8 insertions(+), 1 deletions(-)

lib/std/crypto/25519/field.zig+8-1
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const crypto = std.crypto;3const crypto = std.crypto;
3const readIntLittle = std.mem.readIntLittle;4const readIntLittle = std.mem.readIntLittle;
4const writeIntLittle = std.mem.writeIntLittle;5const writeIntLittle = std.mem.writeIntLittle;
...@@ -6,6 +7,12 @@ const writeIntLittle = std.mem.writeIntLittle;...@@ -6,6 +7,12 @@ const writeIntLittle = std.mem.writeIntLittle;
6const NonCanonicalError = crypto.errors.NonCanonicalError;7const NonCanonicalError = crypto.errors.NonCanonicalError;
7const NotSquareError = crypto.errors.NotSquareError;8const NotSquareError = crypto.errors.NotSquareError;
89
10// Inline conditionally, when it can result in large code generation.
11const bloaty_inline = switch (builtin.mode) {
12 .ReleaseSafe, .ReleaseFast => .Inline,
13 .Debug, .ReleaseSmall => .Unspecified,
14};
15
9pub const Fe = struct {16pub const Fe = struct {
10 limbs: [5]u64,17 limbs: [5]u64,
1118
...@@ -264,7 +271,7 @@ pub const Fe = struct {...@@ -264,7 +271,7 @@ pub const Fe = struct {
264 }271 }
265272
266 /// Multiply two field elements273 /// Multiply two field elements
267 pub inline fn mul(a: Fe, b: Fe) Fe {274 pub fn mul(a: Fe, b: Fe) callconv(bloaty_inline) Fe {
268 var ax: [5]u128 = undefined;275 var ax: [5]u128 = undefined;
269 var bx: [5]u128 = undefined;276 var bx: [5]u128 = undefined;
270 var a19: [5]u128 = undefined;277 var a19: [5]u128 = undefined;