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 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const crypto = std.crypto;
34const readIntLittle = std.mem.readIntLittle;
45const writeIntLittle = std.mem.writeIntLittle;
......@@ -6,6 +7,12 @@ const writeIntLittle = std.mem.writeIntLittle;
67const NonCanonicalError = crypto.errors.NonCanonicalError;
78const 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
916pub const Fe = struct {
1017 limbs: [5]u64,
1118
......@@ -264,7 +271,7 @@ pub const Fe = struct {
264271 }
265272
266273 /// 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 {
268275 var ax: [5]u128 = undefined;
269276 var bx: [5]u128 = undefined;
270277 var a19: [5]u128 = undefined;