hare

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

commit fee8e8584c043e8d02ec2b7c50cfa4282c6dc66b
parent dddfd14dd74dddc424978ca94e532cd5a45db61a
Author: Alexey Yerin <yyp@disroot.org>
Date:   Sun, 16 Jun 2024 21:10:06 +0300

Use 'def' globals where possible

Signed-off-by: Alexey Yerin <yyp@disroot.org>

Diffstat:
Mcrypto/sha1/sha1.ha | 8++++----
Mstrconv/stof.ha | 4++--
Mtime/types.ha | 7++-----
3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/crypto/sha1/sha1.ha b/crypto/sha1/sha1.ha @@ -124,10 +124,10 @@ fn sum(h: *hash::hash, buf: []u8) void = { endian::beputu32(buf[16..], h.h[4]); }; -let K0: u32 = 0x5A827999; -let K1: u32 = 0x6ED9EBA1; -let K2: u32 = 0x8F1BBCDC; -let K3: u32 = 0xCA62C1D6; +def K0: u32 = 0x5A827999; +def K1: u32 = 0x6ED9EBA1; +def K2: u32 = 0x8F1BBCDC; +def K3: u32 = 0xCA62C1D6; // A generic, pure Hare version of the SHA-1 block step fn block(h: *state, p: []u8) void = { diff --git a/strconv/stof.ha b/strconv/stof.ha @@ -11,8 +11,8 @@ use ascii; use math; use strings; -const maxshift: u8 = 60; -const decimal_point_range: u16 = 2047; +def maxshift: u8 = 60; +def decimal_point_range: u16 = 2047; type decimal = struct { num_digits: size, diff --git a/time/types.ha b/time/types.ha @@ -25,17 +25,14 @@ export def MINUTE: duration = 60 * SECOND; // [[duration]] representing an hour. export def HOUR: duration = 60 * MINUTE; -// TODO: change the following to defs when compileable. -// https://git.sr.ht/~sircmpwn/harec/tree/211b99a/item/src/typedef.c#L169 - // The earliest representable [[instant]]. -export const INSTANT_MIN = instant { +export def INSTANT_MIN = instant { sec = types::I64_MIN, nsec = 0, }; // The latest representable [[instant]]. -export const INSTANT_MAX = instant { +export def INSTANT_MAX = instant { sec = types::I64_MAX, nsec = SECOND - 1, };