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 noreply@github.comGitHub <noreply@github.com> 2022-11-14 16:37:19+01:00
log7eed028f9a538624b90279aa430f6e136a77f6a2
tree1c141e03916c1ae770bc5b0a10f8d9df268a4232
parentd823680e18d53bd08689fc86e4ad9c4955c7298b
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

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) {