Oddbean new post about | logout
 Hmmm @ec6e9c30, doesn’t seem to be POSIX, but most libc seem to provide bswap(3) which I’d use optionally #if the target is big endian, then cast to the target struct.

I don’t think there’s a better way at machine level, e.g. in Zig with comptime and @byteSwap builtin it would look less like a hack but 🤷 
 @edec528e I at least don't have to are about the endianness of the platform, it's all network-endian and it's building for arm microcontrollers. Nothing posix in this stack :P