Stream: helpdesk (published)

Topic: How to use `mmap` with Big-Endian bytes?


view this post on Zulip Júlio Hoffimann (Nov 20 2025 at 21:17):

Is there a way to memory-map a file on disk with Big-Endian bytes?

view this post on Zulip Sukera (Nov 20 2025 at 21:31):

No, the endianness is deeply tied to the memory architecture of the hardware.

view this post on Zulip Sukera (Nov 20 2025 at 21:34):

The order bytes are read in from a disk is, for almost all architectures, hardcoded. If the data you have stored on disk is stored with a different endianness, you'll have to decode that at some point to use it for regular code expecting the native endianness of your CPU.


Last updated: Nov 27 2025 at 04:44 UTC