I just stumbled across the functions Num.bytesToU64 and co.
Which endianness is used for these? Big? Little? Whatever is native?
I thought we gave those an endianness parameter, given we didn't, must be native
2 messages were moved here from #beginners > Reserved keywords by Qqwy / Marten.
At some point, we decided that we don't want to expose any machine specifics in roc. Tests completely in roc should give the exact same results no matter if they run via wasm in the browser, m1 mac, or some x86 machine. As such, I think this should definitely change to require specifying the endianness. That said, that does lead to a potential perf issue unless the underlying platform exposes endianness to a roc app.
are there any platforms where roc makes sense that have the non-network endianness?
(I always forget which of them that is)
TCP/IP is big-endian and most CPUs are little-endian
So that's actually the vastly dominant case
sure but the performance should not be a problem: big-endian is always slow, little-endian is native and therefore always faster
yeah I think all functions like this should take an explicit endianness :thumbs_up:
Last updated: Jul 06 2025 at 12:14 UTC