hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 4a75403ac7c53e7bb4bde78a30fe122aacf567c2
parent 7bb816f3cadd4288b23a06ce306fdebcbce80d9d
Author: Armin Preiml <apreiml@strohwolke.at>
Date:   Sat, 19 Aug 2023 20:36:48 +0200

hash: use SZ as suffix for sizes

Signed-off-by: Armin Preiml <apreiml@strohwolke.at>

Diffstat:
Mhash/adler32/adler32.ha | 2+-
Mhash/crc16/crc16.ha | 6+++---
Mhash/crc32/crc32.ha | 6+++---
Mhash/crc64/crc64.ha | 6+++---
4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/hash/adler32/adler32.ha b/hash/adler32/adler32.ha @@ -8,7 +8,7 @@ use io; use strings; // The size, in bytes, of an Adler-32 checksum. -export def SIZE: size = 4; +export def SZ: size = 4; export type state = struct { hash::hash, diff --git a/hash/crc16/crc16.ha b/hash/crc16/crc16.ha @@ -8,7 +8,7 @@ use io; use strings; // The size, in bytes, of a CRC-16 checksum. -export def SIZE: size = 2; +export def SZ: size = 2; // CRC-CCITT polynomial for CRC-16. The most commonly used polynomial, used in // Bluetooth, X.25, XMODEM, and many other places. Also known as CRC-X25. @@ -197,7 +197,7 @@ export fn crc16(table: *[256]u16) state = state { stream = &crc16_vtable, sum = &sum, reset = &reset, - sz = SIZE, + sz = SZ, table = table, cval = ~0u16, ... @@ -248,7 +248,7 @@ export fn sum16(h: *hash::hash) u16 = { let crc_dect = crc16(&dect_table); let crc_ansi = crc16(&ansi_table); - let buf: [SIZE]u8 = [0...]; + let buf: [SZ]u8 = [0...]; for (let i = 0z; i < len(vectors); i += 1) { let vec = vectors[i]; diff --git a/hash/crc32/crc32.ha b/hash/crc32/crc32.ha @@ -8,7 +8,7 @@ use io; use strings; // The size, in bytes, of a CRC-32 checksum. -export def SIZE: size = 4; +export def SZ: size = 4; // IEEE polynomial for CRC-32. Used in ethernet, SATA, MPEG-2, gzip, bzip2, // cksum, PNG, etc. It is by far the most common polynomial used. @@ -204,7 +204,7 @@ export fn crc32(table: *[256]u32) state = state { stream = &crc32_vtable, sum = &sum, reset = &reset, - sz = SIZE, + sz = SZ, table = table, cval = ~0u32, ... @@ -252,7 +252,7 @@ export fn sum32(h: *hash::hash) u32 = { let crc_castagnoli = crc32(&castagnoli_table); let crc_koopman = crc32(&koopman_table); - let buf: [SIZE]u8 = [0...]; + let buf: [SZ]u8 = [0...]; for (let i = 0z; i < len(vectors); i += 1) { let vec = vectors[i]; diff --git a/hash/crc64/crc64.ha b/hash/crc64/crc64.ha @@ -8,7 +8,7 @@ use io; use strings; // The size, in bytes, of a CRC-64 checksum. -export def SIZE: size = 8; +export def SZ: size = 8; // ECMA polynomial for CRC-64. Used in ECMA-182 and xz-utils. export def ECMA: u64 = 0xC96C5795D7870F42; @@ -236,7 +236,7 @@ export fn crc64(table: *[256]u64) state = state { stream = &crc64_vtable, sum = &sum, reset = &reset, - sz = SIZE, + sz = SZ, table = table, cval = ~0u64, ... @@ -282,7 +282,7 @@ export fn sum64(h: *hash::hash) u64 = { let crc_ecma = crc64(&ecma_table); let crc_iso = crc64(&iso_table); - let buf: [SIZE]u8 = [0...]; + let buf: [SZ]u8 = [0...]; for (let i = 0z; i < len(vectors); i += 1) { let vec = vectors[i];