| ... | @@ -12,8 +12,8 @@ const Vec16 = @Vector(16, u32); | ... | @@ -12,8 +12,8 @@ const Vec16 = @Vector(16, u32); |
| 12 | const chunk_length = 1024; | 12 | const chunk_length = 1024; |
| 13 | const max_depth = 54; | 13 | const max_depth = 54; |
| 14 | | 14 | |
| 15 | pub const simd_degree = std.simd.suggestVectorLength(u32) orelse 1; | 15 | const simd_degree = std.simd.suggestVectorLength(u32) orelse 1; |
| 16 | pub const max_simd_degree = simd_degree; | 16 | const max_simd_degree = simd_degree; |
| 17 | const max_simd_degree_or_2 = if (max_simd_degree > 2) max_simd_degree else 2; | 17 | const max_simd_degree_or_2 = if (max_simd_degree > 2) max_simd_degree else 2; |
| 18 | | 18 | |
| 19 | /// Threshold for switching to parallel processing. | 19 | /// Threshold for switching to parallel processing. |
| ... | @@ -502,9 +502,7 @@ fn hashManySimd( | ... | @@ -502,9 +502,7 @@ fn hashManySimd( |
| 502 | var out_ptr = out.ptr; | 502 | var out_ptr = out.ptr; |
| 503 | var cnt = counter; | 503 | var cnt = counter; |
| 504 | | 504 | |
| 505 | const simd_deg = comptime simd_degree; | 505 | if (simd_degree >= 16) { |
| 506 | | | |
| 507 | if (comptime simd_deg >= 16) { | | |
| 508 | while (remaining >= 16) { | 506 | while (remaining >= 16) { |
| 509 | const sixteen_inputs = [16][*]const u8{ | 507 | const sixteen_inputs = [16][*]const u8{ |
| 510 | inp[0], inp[1], inp[2], inp[3], | 508 | inp[0], inp[1], inp[2], inp[3], |
| ... | @@ -525,7 +523,7 @@ fn hashManySimd( | ... | @@ -525,7 +523,7 @@ fn hashManySimd( |
| 525 | } | 523 | } |
| 526 | } | 524 | } |
| 527 | | 525 | |
| 528 | if (comptime simd_deg >= 8) { | 526 | if (simd_degree >= 8) { |
| 529 | while (remaining >= 8) { | 527 | while (remaining >= 8) { |
| 530 | const eight_inputs = [8][*]const u8{ | 528 | const eight_inputs = [8][*]const u8{ |
| 531 | inp[0], inp[1], inp[2], inp[3], | 529 | inp[0], inp[1], inp[2], inp[3], |
| ... | @@ -544,7 +542,7 @@ fn hashManySimd( | ... | @@ -544,7 +542,7 @@ fn hashManySimd( |
| 544 | } | 542 | } |
| 545 | } | 543 | } |
| 546 | | 544 | |
| 547 | if (comptime simd_deg >= 4) { | 545 | if (simd_degree >= 4) { |
| 548 | while (remaining >= 4) { | 546 | while (remaining >= 4) { |
| 549 | const four_inputs = [4][*]const u8{ | 547 | const four_inputs = [4][*]const u8{ |
| 550 | inp[0], | 548 | inp[0], |
| ... | @@ -571,7 +569,7 @@ fn hashManySimd( | ... | @@ -571,7 +569,7 @@ fn hashManySimd( |
| 571 | } | 569 | } |
| 572 | | 570 | |
| 573 | fn hashMany(inputs: [][*]const u8, num_inputs: usize, blocks: usize, key: [8]u32, counter: u64, increment_counter: bool, flags: Flags, flags_start: Flags, flags_end: Flags, out: []u8) void { | 571 | fn hashMany(inputs: [][*]const u8, num_inputs: usize, blocks: usize, key: [8]u32, counter: u64, increment_counter: bool, flags: Flags, flags_start: Flags, flags_end: Flags, out: []u8) void { |
| 574 | if (comptime max_simd_degree >= 4) { | 572 | if (max_simd_degree >= 4) { |
| 575 | hashManySimd(inputs, num_inputs, blocks, key, counter, increment_counter, flags, flags_start, flags_end, out); | 573 | hashManySimd(inputs, num_inputs, blocks, key, counter, increment_counter, flags, flags_start, flags_end, out); |
| 576 | } else { | 574 | } else { |
| 577 | hashManyPortable(inputs, num_inputs, blocks, key, counter, increment_counter, flags, flags_start, flags_end, out); | 575 | hashManyPortable(inputs, num_inputs, blocks, key, counter, increment_counter, flags, flags_start, flags_end, out); |
| ... | @@ -909,7 +907,7 @@ pub const Blake3 = struct { | ... | @@ -909,7 +907,7 @@ pub const Blake3 = struct { |
| 909 | pub const digest_length = 32; | 907 | pub const digest_length = 32; |
| 910 | pub const key_length = 32; | 908 | pub const key_length = 32; |
| 911 | | 909 | |
| 912 | pub const Options = struct { key: ?[digest_length]u8 = null }; | 910 | pub const Options = struct { key: ?[key_length]u8 = null }; |
| 913 | pub const KdfOptions = struct {}; | 911 | pub const KdfOptions = struct {}; |
| 914 | | 912 | |
| 915 | key: [8]u32, | 913 | key: [8]u32, |