authorgravatar for xq@random-projects.netFelix "xq" Queißner <xq@random-projects.net> 2022-05-05 10:24:41+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-16 22:31:09-04:00
log6d27341b96240a4ae70c794eb05dec452fd31451
treed96a5f0ea506f7c6421b30ce7f2bc9a5868bf56f
parent5888446c03b1f77a031f5a8093488a6a2f6decb6

Fixes comptime 'error: cannot assign to constant' error in siphash.


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

lib/std/crypto/siphash.zig+4-1
...@@ -78,9 +78,12 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round...@@ -78,9 +78,12 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round
78 pub fn update(self: *Self, b: []const u8) void {78 pub fn update(self: *Self, b: []const u8) void {
79 std.debug.assert(b.len % 8 == 0);79 std.debug.assert(b.len % 8 == 0);
8080
81 const inl = std.builtin.CallOptions{ .modifier = .always_inline };
82
81 var off: usize = 0;83 var off: usize = 0;
82 while (off < b.len) : (off += 8) {84 while (off < b.len) : (off += 8) {
83 @call(.{ .modifier = .always_inline }, self.round, .{b[off..][0..8].*});85 const blob = b[off..][0..8].*;
86 @call(inl, round, .{ self, blob });
84 }87 }
8588
86 self.msg_len +%= @truncate(u8, b.len);89 self.msg_len +%= @truncate(u8, b.len);