I am working on code for which byte order is relevant when unpacking binary data. My understanding is that most modern architectures are little-endian, so I could just put an
Base.ENDIAN_BOM == 0x04030201 || error("only little-endian is supported")
and be done with it.
Is this a reasonable approach? Or are there any big-endian architectures in use that I don’t know about? (I know little about these things).
If yes, is there a free CI service that allows testing?
(The issue is basically that the data is in little-endian format, with matching architecture I can just
mmap, otherwise I need to
Some Atom CPUs are “switchable” that is the most likely big endian architecture us peons are likely to (currently) have access to. Other than that unless you expect this to run on mainframes you probably don’t have to worry about it…unless a new architecture is born that needs to be big endian for some reason.
Part of me shudders saying that…I might have a pathological need to ensure my code can run everywhere…
I’m pretty sure POWER9 CPUs are switchable at boot time as well, however these are also currently hard to come by (and are generally very expensive compared to x86-64). And Julia doesn’t have great support for them right now, last I recall.
I would say throwing an error is the best approach if you don’t have access to big endian CI to test with (or desire to build in support). IMO, just say in your error, “Big endian is not yet supported”, which implies that a PR to add support would be welcomed.
I always welcome PRs, but in this case I would not be able to test them, or commit to fixing issues (because I would not be able to reproduce them).
So my tentative conclusion is that for the time being, I would just rule out any architecture that is not little endian.
I’m working to make a package to read LabView TDMS files, which supports optional big endian layout. I’m debating as to whether to bother implementing support for it, when in practice it’s probably never used.
As far as I know, no one has ever run Julia on bigendian architecture. If you want to try, I would suggest asking for an account at OSU OSL OpenStack POWER. I would be keen to hear how you go.