Copied from here:
http://forums.winamp.com/showthread.php?postid=1813470#post1813470
Explanation of the endianness problem: util.h wasn't
detecting the endianness correctly when defining
FIX_ENDIAN_INT32_INPLACE. On linux you detect this by
including endian.h and testing if BYTE_ORDER ==
LITTLE_ENDIAN. I'm not sure how portable this is, so
there is no proper patch yet. A quick grep reveals a
few places test for __BIG_ENDIAN__, most of them are
not relevant because they are in code that is compiled
using the Win32 cross compiler.
Logged In: YES
user_id=584402
How about the attached patch?
proposed changes
Logged In: YES
user_id=35028
I won't be able to test it until I upload a new version.
Anyway, this was with GCC 4.0, so your comments in the patch
don't apply and I'm not sure how portable the test you used
is. Perhaps the test could be something like this:
#ifndef __BIG_ENDIAN__
#include <endian.h>
#endif
int main() {
#ifdef __BIG_ENDIAN__
return 0;
#else
return BYTE_ORDER == BIG_ENDIAN;
#endif
}
There is also PDP_ENDIAN, but those computers are rare and
old, no point targeting them.
Logged In: YES
user_id=584402
I read somewhere that only GCC 4 defines those, but you're
right, it doesn't either. Using endian.h is not portable
enough. It doesn't, for example, work on sparc-solaris1 on
SF CF. Do you see any problem with my test?
Logged In: YES
user_id=35028
OK, how about you apply it and we see how well it works out when I upload the next release. I'll get a list of endianness for all of Debian's platforms and compare that to what your test detects (I'll figure out a way of outputting the test results). Hopefully it will work and correctly detect the endianness for all platforms.
Logged In: YES
user_id=584402
OK, it'll be released along with 2.12 this weekend. The test
should print its result as part of the scons log. It should
like the following:
Checking for __BIG_ENDIAN__... no