From fb52b2dcdf9cef0ad1eb1e442072472113d1f6cc Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 29 May 2026 13:09:47 +0200 Subject: [PATCH] Remove unnecessary inline, comment on the necessary one --- lib/std/crypto/argon2.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/std/crypto/argon2.zig b/lib/std/crypto/argon2.zig index 91c4f60796c2ab989be425188b5a09d86a8338f2..58f3e2afbbd1d570b2df3d4370fbbd2fe79ccb80 100644 --- a/lib/std/crypto/argon2.zig +++ b/lib/std/crypto/argon2.zig @@ -364,17 +364,20 @@ fn processBlockGeneric( const BlamkaVector = @Vector(4, u64); -inline fn fBlaMka(x: BlamkaVector, y: BlamkaVector) BlamkaVector { +fn fBlaMka(x: BlamkaVector, y: BlamkaVector) BlamkaVector { const x_lo: @Vector(4, u32) = @truncate(x); const y_lo: @Vector(4, u32) = @truncate(y); const xy = @as(BlamkaVector, x_lo) * @as(BlamkaVector, y_lo); return x +% y +% @as(BlamkaVector, @splat(2)) *% xy; } -inline fn rotrVector(x: BlamkaVector, comptime n: comptime_int) BlamkaVector { +fn rotrVector(x: BlamkaVector, comptime n: comptime_int) BlamkaVector { return (x >> @splat(n)) | (x << @splat(64 - n)); } +// The `inline` is load-bearing: without it ReleaseSmall keeps this out of line +// and shuffles the four vectors through memory across every call, costing +// roughly 9% on Apple Silicon. inline fn blamkaRound(a: *BlamkaVector, b: *BlamkaVector, c: *BlamkaVector, d: *BlamkaVector) void { a.* = fBlaMka(a.*, b.*); d.* = rotrVector(d.* ^ a.*, 32); -- 2.54.0