commit 8bfee5cdda2c957d35e730a2b3e744b390c62070
parent 68f62ed83904ee38acedc342cf0d3ff0569cf46c
Author: Kiëd Llaentenn <kiedtl@tilde.team>
Date: Mon, 26 Apr 2021 00:47:39 +0000
hash::crc32: Export SIZE definition
Signed-off-by: Kiëd Llaentenn <kiedtl@tilde.team>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hash/crc32/crc32.ha b/hash/crc32/crc32.ha
@@ -4,6 +4,9 @@ use io;
use strings;
use fmt;
+// The size, in bytes, of a CRC-32 checksum.
+export def SIZE: size = 4;
+
// IEEE polynomial for CRC-32. Used in ethernet, SATA, MPEG-2, gzip, bsip2,
// cksum, PNG, etc. It is by far the most common polynomial used.
export const IEEE: u32 = 0xedb88320;
@@ -250,7 +253,7 @@ export fn sum32(h: *hash::hash) u32 = {
let crc_koopman = crc32(&KOOPMAN_TABLE);
defer hash::close(crc_koopman);
- let buf: [4]u8 = [0...];
+ let buf: [SIZE]u8 = [0...];
for (let i = 0z; i < len(vectors); i += 1) {
let vec = vectors[i];