runtime: fix sleep duration for long sleeps

Long sleep durations weren't implemented correctly, by simply casting to
a smaller number of bits. What we want is a saturating downcast, which
is what I've used here instead.

This should fix https://github.com/tinygo-org/tinygo/issues/3356.
This commit is contained in:
Ayke van Laethem
2025-10-01 11:56:18 +02:00
committed by Ron Evans
parent faf455283d
commit 8872d5ebfc
5 changed files with 14 additions and 2 deletions
+2 -2
View File
@@ -43,8 +43,8 @@ func TestBinarySize(t *testing.T) {
tests := []sizeTest{
// microcontrollers
{"hifive1b", "examples/echo", 3884, 280, 0, 2268},
{"microbit", "examples/serial", 2852, 360, 8, 2272},
{"wioterminal", "examples/pininterrupt", 7337, 1491, 116, 6912},
{"microbit", "examples/serial", 2844, 360, 8, 2272},
{"wioterminal", "examples/pininterrupt", 7349, 1491, 116, 6912},
// TODO: also check wasm. Right now this is difficult, because
// wasm binaries are run through wasm-opt and therefore the