hare

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

commit d3b7e0ce4258beaa92cf78fd3818942c3db7c99b
parent 5aaec08f83d401cbeea4a07fe15929af34a0c7f0
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat,  4 Sep 2021 08:09:17 +0200

hash::*: remove closers

These are not necessary.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mhash/adler32/adler32.ha | 4+---
Mhash/crc16/crc16.ha | 2+-
Mhash/crc32/crc32.ha | 3---
Mhash/crc64/crc64.ha | 4+---
Mhash/fnv/fnv.ha | 10++++------
5 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/hash/adler32/adler32.ha b/hash/adler32/adler32.ha @@ -17,16 +17,14 @@ export type state = struct { // when you are done with it. export fn adler32() state = state { writer = &write, - closer = &close, sum = &sum, reset = &reset, sz = 4, a = 1, b = 0, + ... }; -fn close(s: *io::stream) void = void; - fn write(s: *io::stream, buf: const []u8) (size | io::error) = { let s = s: *state; for (let i = 0z; i < len(buf); i += 1) { diff --git a/hash/crc16/crc16.ha b/hash/crc16/crc16.ha @@ -186,12 +186,12 @@ export type state = struct { // custom polynomial, populated by [[memoize]] function, may also be used. export fn crc16(table: *[256]u16) state = state { writer = &write, - closer = &close, sum = &sum, reset = &reset, sz = SIZE, table = table, cval = ~0u16, + ... }; fn close(s: *io::stream) void = void; diff --git a/hash/crc32/crc32.ha b/hash/crc32/crc32.ha @@ -193,7 +193,6 @@ export type state = struct { // custom polynomial, populated by [[memoize]] function, may also be used. export fn crc32(table: *[256]u32) state = state { writer = &write, - closer = &close, sum = &sum, reset = &reset, sz = SIZE, @@ -201,8 +200,6 @@ export fn crc32(table: *[256]u32) state = state { cval = ~0u32, }; -fn close(s: *io::stream) void = void; - fn write(s: *io::stream, buf: const []u8) (size | io::error) = { let s = s: *state; for (let i = 0z; i < len(buf); i += 1) { diff --git a/hash/crc64/crc64.ha b/hash/crc64/crc64.ha @@ -225,16 +225,14 @@ export type state = struct { // by [[memoize]] function, may also be used. export fn crc64(table: *[256]u64) state = state { writer = &write, - closer = &close, sum = &sum, reset = &reset, sz = SIZE, table = table, cval = ~0u64, + ... }; -fn close(s: *io::stream) void = void; - fn write(s: *io::stream, buf: const []u8) (size | io::error) = { let s = s: *state; for (let i = 0z; i < len(buf); i += 1) { diff --git a/hash/fnv/fnv.ha b/hash/fnv/fnv.ha @@ -25,11 +25,11 @@ export type state64 = struct { // Unless you have a reason to use this, [[fnv32a]] is recommended instead. export fn fnv32() state32 = state32 { writer = &fnv32_write, - closer = &fnv_close, sum = &fnv32_sum, reset = &fnv32_reset, sz = 4, v = basis32, + ... }; // Creates a [[hash::hash]] which computes the FNV-1a 32-bit hash function. This @@ -37,11 +37,11 @@ export fn fnv32() state32 = state32 { // when you're done with it. export fn fnv32a() state32 = state32 { writer = &fnv32a_write, - closer = &fnv_close, sum = &fnv32_sum, reset = &fnv32_reset, sz = 4, v = basis32, + ... }; // Creates a [[hash::hash]] which computes the FNV-1 64-bit hash function. This @@ -51,11 +51,11 @@ export fn fnv32a() state32 = state32 { // Unless you have a reason to use this, [[fnv64a]] is recommended instead. export fn fnv64() state64 = state64 { writer = &fnv64_write, - closer = &fnv_close, sum = &fnv64_sum, reset = &fnv64_reset, sz = 8, v = basis64, + ... }; // Creates a [[hash::hash]] which computes the FNV-1a 64-bit hash function. This @@ -63,15 +63,13 @@ export fn fnv64() state64 = state64 { // when you're done with it. export fn fnv64a() state64 = state64 { writer = &fnv64a_write, - closer = &fnv_close, sum = &fnv64_sum, reset = &fnv64_reset, sz = 8, v = basis64, + ... }; -fn fnv_close(s: *io::stream) void = void; - fn fnv32_write(s: *io::stream, buf: const []u8) (size | io::error) = { let s = s: *state32; for (let i = 0z; i < len(buf); i += 1) {