From e33788715ce08f9410290dcea9ca0ddb26692eed Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Wed, 1 Nov 2023 16:48:02 +0100 Subject: Update for Zig 0.11.0 --- src/crc16.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/crc16.zig') diff --git a/src/crc16.zig b/src/crc16.zig index 3ea5a15..1257ea2 100644 --- a/src/crc16.zig +++ b/src/crc16.zig @@ -7,7 +7,7 @@ const crc16tab: [256]u16 = tab: { const poly: u32 = 0x1021; var table: [256]u16 = undefined; - for (table) |*crc, i| { + for (&table, 0..) |*crc, i| { crc.* = @as(u16, i) << 8; var j = 0; while (j < 8) : (j += 1) { @@ -25,7 +25,7 @@ const crc16tab: [256]u16 = tab: { pub fn update(crc: u16, with_data: []const u8) u16 { var new_crc = crc; for (with_data) |b| { - new_crc = (new_crc << 8) ^ crc16tab[@truncate(u8, new_crc >> 8) ^ b]; + new_crc = (new_crc << 8) ^ crc16tab[@as(u8, @truncate(new_crc >> 8)) ^ b]; } return new_crc; } -- cgit v1.2.3