authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2022-11-14 16:37:19+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-09 14:03:11-07:00
logb239a178c5694f630a55ba72c5c96beb656c2a5d
tree4ea9aff9235ed743406afecb2695370179c5982c
parent50fb7a4144a3f0fd4f035c36286a26a3002fafee

crypto.bcrypt: fix massive speed regression when using stage2 (#13518)

state: State -> state: *const State Suggested by @nektro Fixes #13510

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

lib/std/crypto/bcrypt.zig+3-3
......@@ -374,7 +374,7 @@ pub const State = struct {
374374
375375 const Halves = struct { l: u32, r: u32 };
376376
377 fn halfRound(state: State, i: u32, j: u32, n: usize) u32 {
377 fn halfRound(state: *const State, i: u32, j: u32, n: usize) u32 {
378378 var r = state.sboxes[0][@truncate(u8, j >> 24)];
379379 r +%= state.sboxes[1][@truncate(u8, j >> 16)];
380380 r ^= state.sboxes[2][@truncate(u8, j >> 8)];
......@@ -382,7 +382,7 @@ pub const State = struct {
382382 return i ^ r ^ state.subkeys[n];
383383 }
384384
385 fn encipher(state: State, halves: *Halves) void {
385 fn encipher(state: *const State, halves: *Halves) void {
386386 halves.l ^= state.subkeys[0];
387387 comptime var i = 1;
388388 inline while (i < 16) : (i += 2) {
......@@ -393,7 +393,7 @@ pub const State = struct {
393393 halves.* = halves_last;
394394 }
395395
396 fn encrypt(state: State, data: []u32) void {
396 fn encrypt(state: *const State, data: []u32) void {
397397 debug.assert(data.len % 2 == 0);
398398 var i: usize = 0;
399399 while (i < data.len) : (i += 2) {