hare

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

commit 185f6ae0c9fc5da288cbf44b9fd360a5b95d9209
parent 67f02b305e7ae20a24bd6434e6a57bffbdf5e33c
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Sat, 27 Mar 2021 05:43:58 -0400

hash::fnv::fnv*_sum: make use of array allocs

Diffstat:
Mhash/fnv/fnv.ha | 8++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/hash/fnv/fnv.ha b/hash/fnv/fnv.ha @@ -109,9 +109,7 @@ fn fnv32_sum(h: *hash::hash) []u8 = { let h = h: *state32; let buf: [4]u8 = [0...]; endian::host.putu32(buf, h.v); - let sl: []u8 = alloc([], 4); - append(sl, ...buf); - return sl; + return alloc(buf); }; fn fnv64_write(s: *io::stream, buf: const []u8) (size | io::error) = { @@ -141,9 +139,7 @@ fn fnv64_sum(h: *hash::hash) []u8 = { let h = h: *state64; let buf: [8]u8 = [0...]; endian::host.putu64(buf, h.v); - let sl: []u8 = alloc([], 8); - append(sl, ...buf); - return sl; + return alloc(buf); }; // Returns the sum of a 32-bit FNV hash.