_LITTLE_ENDIAN

Andrew Haley aph at redhat.com
Tue Jun 23 15:52:39 UTC 2009


Mario Torre wrote:
> Hello all!
> 
> I have a problem with a block of code that checks if _LITTLE_ENDIAN is
> defined, the code is in little cms and looks like:
> 
> #ifndef _LITTLE_ENDIAN
> #define USE_BIG_ENDIAN   1
> #endif
> 
> The issue that I have is that on VxWorks, the target I'm working on,
> there is always a definition of _LITTLE_ENDIAN, just the value change in
> case of big/little endiannes, and this in my case ends up conflicting
> with the code in the JDK.
> 
> I started to replace all the _LITTLE_ENDIAN to be OPENJDK_LITTLE_ENDIAN,
> and as I think this is nice to have in OpenJDK and will improve
> portability, I would like to discuss the issue with whoever is
> interested (cc some mailing list here, sorry for cross posting).
> 
> Other occurrences of the _LITTLE_ENDIAN define are:
> 
> jdk/src/share/native/sun/awt/medialib/mlib*
> jdk/src/share/native/com/sun/media/sound/
> jdk/src/solaris/native/sun/java2d/loops/
> 
> plus some other little places.
> 
> I need to prepare a patch for that, but before I would like to have some
> suggestion or if you are not interested at all, I'll just fix the
> specific code that we use and not care about all the references.

I guess it all depends on how _LITTLE_ENDIAN is commonly defined.
It'd be a lot easier just to replace

#ifndef _LITTLE_ENDIAN

with

#if ! _LITTLE_ENDIAN

if that's possible.

Andrew.



More information about the build-dev mailing list