diff options
author | Rutger Broekhoff | 2021-05-24 14:36:56 +0200 |
---|---|---|
committer | Rutger Broekhoff | 2021-05-24 14:36:56 +0200 |
commit | d301b753bfffb9ad1790c08dbab8c33b815b7e4c (patch) | |
tree | 5083fc9d163608d0010769bf190f658ff5c6f239 /src/crc16.zig | |
parent | 6e738a7b690649230c8652794b1c207743eb7f9b (diff) | |
download | zig-nkeys-d301b753bfffb9ad1790c08dbab8c33b815b7e4c.tar.gz zig-nkeys-d301b753bfffb9ad1790c08dbab8c33b815b7e4c.zip |
Clean up more
Clean up unnecessary error unions, generate allowed characters table
for credentials file sections at compile time.
Diffstat (limited to 'src/crc16.zig')
-rw-r--r-- | src/crc16.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crc16.zig b/src/crc16.zig index b00c795..2c49500 100644 --- a/src/crc16.zig +++ b/src/crc16.zig | |||
@@ -1,4 +1,4 @@ | |||
1 | const Error = error{InvalidChecksum}; | 1 | pub const InvalidChecksumError = error{InvalidChecksum}; |
2 | 2 | ||
3 | const crc16tab: [256]u16 = tab: { | 3 | const crc16tab: [256]u16 = tab: { |
4 | @setEvalBranchQuota(10000); | 4 | @setEvalBranchQuota(10000); |
@@ -36,6 +36,6 @@ pub fn make(data: []const u8) u16 { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | // validate will check the calculated CRC16 checksum for data against the expected. | 38 | // validate will check the calculated CRC16 checksum for data against the expected. |
39 | pub fn validate(data: []const u8, expected: u16) !void { | 39 | pub fn validate(data: []const u8, expected: u16) InvalidChecksumError!void { |
40 | if (make(data) != expected) return error.InvalidChecksum; | 40 | if (make(data) != expected) return error.InvalidChecksum; |
41 | } | 41 | } |