aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/bytes.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-05-06 17:25:18 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-05-06 17:25:18 -0400
commit2dfaa75c1b711aa26339367bf5bfbb4ac17a8709 (patch)
treec3d293db15b93caa29f88700fcb81804878dafcf /src/stdlib/bytes.c
parent1b0d20f51cd3c0c2ec88702f6a852202d8ac32d7 (diff)
Bugfix for converting integer to byte
Diffstat (limited to 'src/stdlib/bytes.c')
-rw-r--r--src/stdlib/bytes.c2
1 files changed, 1 insertions, 1 deletions
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)