Skip to content

Commit ccf00cc

Browse files
authored
crypto.25519.field: de-inline mul for small builds (#14775)
1 parent 6ab04b5 commit ccf00cc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/std/crypto/25519/field.zig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
const std = @import("std");
2+
const builtin = @import("builtin");
23
const crypto = std.crypto;
34
const readIntLittle = std.mem.readIntLittle;
45
const writeIntLittle = std.mem.writeIntLittle;
56

67
const NonCanonicalError = crypto.errors.NonCanonicalError;
78
const NotSquareError = crypto.errors.NotSquareError;
89

10+
// Inline conditionally, when it can result in large code generation.
11+
const bloaty_inline = switch (builtin.mode) {
12+
.ReleaseSafe, .ReleaseFast => .Inline,
13+
.Debug, .ReleaseSmall => .Unspecified,
14+
};
15+
916
pub 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;

0 commit comments

Comments
 (0)