We currently use BIG_ENDIAN
encoding in OpenFL ByteArray
by default, in order to match Flash. This makes it confusing, though, to read and write files on a local filesystem, as most platforms are LITTLE_ENDIAN
. This means that reading and writing between programs, the data will be in a different order. Using BIG_ENDIAN
on LITTLE_ENDIAN
CPUs may also have a performance impact. I had thought about changing this, but am concerned of the impact on ported code.
Changing this could affect some code that relies on the default endian
value being BIG_ENDIAN
, but most code would work unchanged.
Arguably, using the default endianness of the platform is the best approach, and is similar to most platforms, but this is a breaking change for some projects, I wanted to hear your opinion
What endianness should we use in ByteArray?
- Use the default endianness of the host platform (
LITTLE_ENDIAN
for most platforms,BIG_ENDIAN
for Flash) - Use
BIG_ENDIAN
on all platforms for consistency with Flash
0 voters
Thank you!