From 5f0ecafa0dddd9b630220d1c6cf4be2e42987faf Mon Sep 17 00:00:00 2001 From: Marc Tiehuis Date: Sun, 28 Apr 2024 21:12:55 +1200 Subject: [PATCH] std.hash.crc: update legacy crc usage in std --- lib/std/debug.zig | 2 +- lib/std/hash/benchmark.zig | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index eaa5ca9ff7..09de1f5930 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1150,7 +1150,7 @@ pub fn readElfDebugInfo( }; const mapped_mem = try mapWholeFile(elf_file); - if (expected_crc) |crc| if (crc != std.hash.crc.Crc32SmallWithPoly(.IEEE).hash(mapped_mem)) return error.InvalidDebugInfo; + if (expected_crc) |crc| if (crc != std.hash.crc.Crc32.hash(mapped_mem)) return error.InvalidDebugInfo; const hdr: *const elf.Ehdr = @ptrCast(&mapped_mem[0]); if (!mem.eql(u8, hdr.e_ident[0..4], elf.MAGIC)) return error.InvalidElfMagic; diff --git a/lib/std/hash/benchmark.zig b/lib/std/hash/benchmark.zig index 518b4ca99e..0798e26d6f 100644 --- a/lib/std/hash/benchmark.zig +++ b/lib/std/hash/benchmark.zig @@ -56,12 +56,8 @@ const hashes = [_]Hash{ .name = "adler32", }, Hash{ - .ty = hash.crc.Crc32WithPoly(.IEEE), - .name = "crc32-slicing-by-8", - }, - Hash{ - .ty = hash.crc.Crc32SmallWithPoly(.IEEE), - .name = "crc32-half-byte-lookup", + .ty = hash.crc.Crc32, + .name = "crc32", }, Hash{ .ty = hash.CityHash32,