From 2dfaa75c1b711aa26339367bf5bfbb4ac17a8709 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 6 May 2025 17:25:18 -0400 Subject: Bugfix for converting integer to byte --- src/stdlib/bytes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/stdlib/bytes.c b/src/stdlib/bytes.c index 5605b2c8..3373cb55 100644 --- a/src/stdlib/bytes.c +++ b/src/stdlib/bytes.c @@ -83,7 +83,7 @@ public PUREFUNC Byte_t Byte$from_int(Int_t i, bool truncate) { fail("This value is too large to convert to a byte without truncation: ", i); else if unlikely (truncate && Int$compare_value(i, I_small(0)) < 0) fail("Negative values can't be converted to bytes: ", i); - return (i.small != 0); + return (Byte_t)(i.small >> 2); } public PUREFUNC Byte_t Byte$from_int64(Int64_t i, bool truncate) { if unlikely (truncate && i != (Int64_t)(Byte_t)i) -- cgit v1.2.3