Hi Nick
If you know, beforehand, that your CPU is using Little Endian convention,
then yes, you are right : by commenting out this define, you ensure LZ4 code will consider the CPU as being Little Endian, regardless of the detection macro.
What's strange however is that you seem positive in the fact that your data producer is Big Endian. If it was, then using the "Big endian" code variant would be necessary to preserve compatibility with Little Endian target.
It seems it just does not happen this way, and you need the "Little Endian" path to preserve compatibility.
Sometimes, some CPU which are "Big Endian by default" are in fact endian-selectable (or called Bi-Endian, see
http://en.wikipedia.org/wiki/Endianness#Bi-endian_hardware), they can run a program using Little-Endian mode too, depending on some parameters provided by the system. Maybe that's what happens on your Android device ?
The case you rise seems to point towards a False positive in the automatic Big Endian detection routine. CPU Feature detection is still, to this date, an empirical process, which can be flawed in unforeseen environments.
Specifically, Endianess is detected at compile time within LZ4, and therefore fixed into the binary. This is a problem if the target system can "select its endianess" at will during runtime.
Dynamic detection is implemented within lz4demo. It works fine, since this routine has much less impact on global performance.
It's possible to introduce the same dynamic model into lz4, but that will cost a bit of performance, due to extra checks within critical loops.
Your comments are always welcomed.
Regards
Yann