Examples:
Code: Select all
ReadDouble(#File, #big_endian)
ReadLong(#File, #big_endian)
WriteLong(#File, Number, #big_endian)
etc., where the read values are adjusted to little endianess at read time.
Because of the strong ties between PureBasic and the Amiga world, and since many vintage file formats are stored using big endianess (e.g. Amiga IFF), it would be nice to see endianess handling added to PB natively. Hopefully, adding this to the PB language shouldn't be a huge work, and it would provide a much more efficient solution than custom workarounds, besides keeping the source code slimmer.
Since little-endian is the default, it probably makes sense to only add the big-endian flag (unless also adding #little_endian makes sense for completeness sake, even though it wouldn't change the current behavior).