diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-04-29 00:19:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-29 00:19:55 -0700 |
| commit | d65b42e07caa00dfe2f2fbf221c593ce57882784 (patch) | |
| tree | 7926cbea1499e0affe930bf6d7455dc24adf014e /lib/std/crypto/sha1.zig | |
| parent | fd6200eda6d4fe19c34a59430a88a9ce38d6d7a4 (diff) | |
| parent | fa200ca0cad2705bad40eb723dedf4e3bf11f2ff (diff) | |
| download | zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.tar.gz zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.zip | |
Merge pull request #15481 from ziglang/use-mem-intrinsics
actually use the new memory intrinsics
Diffstat (limited to 'lib/std/crypto/sha1.zig')
| -rw-r--r-- | lib/std/crypto/sha1.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/crypto/sha1.zig b/lib/std/crypto/sha1.zig index 4d11b04eb5..1f5f3eaae2 100644 --- a/lib/std/crypto/sha1.zig +++ b/lib/std/crypto/sha1.zig @@ -62,7 +62,7 @@ pub const Sha1 = struct { // Partial buffer exists from previous update. Copy into buffer then hash. if (d.buf_len != 0 and d.buf_len + b.len >= 64) { off += 64 - d.buf_len; - mem.copy(u8, d.buf[d.buf_len..], b[0..off]); + @memcpy(d.buf[d.buf_len..][0..off], b[0..off]); d.round(d.buf[0..]); d.buf_len = 0; @@ -74,7 +74,7 @@ pub const Sha1 = struct { } // Copy any remainder for next pass. - mem.copy(u8, d.buf[d.buf_len..], b[off..]); + @memcpy(d.buf[d.buf_len..][0 .. b.len - off], b[off..]); d.buf_len += @intCast(u8, b[off..].len); d.total_len += b.len; @@ -82,7 +82,7 @@ pub const Sha1 = struct { pub fn final(d: *Self, out: *[digest_length]u8) void { // The buffer here will never be completely full. - mem.set(u8, d.buf[d.buf_len..], 0); + @memset(d.buf[d.buf_len..], 0); // Append padding bits. d.buf[d.buf_len] = 0x80; @@ -91,7 +91,7 @@ pub const Sha1 = struct { // > 448 mod 512 so need to add an extra round to wrap around. if (64 - d.buf_len < 8) { d.round(d.buf[0..]); - mem.set(u8, d.buf[0..], 0); + @memset(d.buf[0..], 0); } // Append message length. |
