hare

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

commit 98c6e62211a464ca264be2fecb92c9dbe2147123
parent 6b464c4043c8215cb409b97e0befc474cf6d6458
Author: Byron Torres <b@torresjrjr.com>
Date:   Tue, 24 May 2022 04:00:22 +0100

time::chrono: make lookup_leaps accept a pointer

Signed-off-by: Byron Torres <b@torresjrjr.com>

Diffstat:
Mtime/chrono/timescale.ha | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/time/chrono/timescale.ha b/time/chrono/timescale.ha @@ -50,7 +50,7 @@ export const utc: timescale = timescale { }; fn conv_tai_utc(a: time::instant) (time::instant | time::error) = { - const idx = lookup_leaps(utc_leapsecs, time::unix(a)); + const idx = lookup_leaps(&utc_leapsecs, time::unix(a)); const ofst = utc_leapsecs[idx].1; if (time::unix(a) == utc_leapsecs[idx].0) { @@ -65,7 +65,7 @@ fn conv_tai_utc(a: time::instant) (time::instant | time::error) = { }; fn conv_utc_tai(a: time::instant) (time::instant | time::error) = { - const idx = lookup_leaps(utc_leapsecs, time::unix(a)); + const idx = lookup_leaps(&utc_leapsecs, time::unix(a)); const ofst = utc_leapsecs[idx].1; if (time::unix(a) == utc_leapsecs[idx].0) { @@ -79,7 +79,7 @@ fn conv_utc_tai(a: time::instant) (time::instant | time::error) = { return b; }; -fn lookup_leaps(list: [](i64, i64), t: i64) size = { +fn lookup_leaps(list: *[](i64, i64), t: i64) size = { let lo = 0z, hi = len(list); for (hi - lo > 1) { const mid = lo + (hi - lo) / 2;