[Bf-committers] Re: image editor / draw alpha

Ton Roosendaal ton at blender.org
Wed Jun 14 16:34:24 CEST 2006


Hi,

Using defines for endianness is a bit cumbersome. In Blender code we  
use this:

./blenkernel/intern/blender.c:207:      G.order= 1; /* is short */
./blenkernel/intern/blender.c:208:      G.order=  
(((char*)&G.order)[0])?L_ENDIAN:B_ENDIAN

Gives guaranteed results. :)

I cannot find a reason why makefiles or scons should should set such  
defines... apart from some of the non-Blender libraries.

-Ton-


On 14 Jun, 2006, at 3:16, Ed Halley wrote:

>
> On Jun 13, 2006, at 7:47 PM, Branan Riley wrote:
>> I'm running Gentoo Linux x86-64 on a Pentium 4, so endianness is
>> probably the issue. I don't think testing for the Mac OS define would
>> work, since there are also Intel-based macs. Does anyoen know the
>> right define to check for to distinguish endianness?
>
> The current patch* for Mac Intel endianness looks for each of these:
>
>    #if ... || defined(__APPLE__)
>
> and turns them into
>
>    #if ... || (defined(__APPLE__) && !defined(__LITTLE_ENDIAN__))
>
> Similar adjustments are made in a couple makefiles.
>
> I am all for defining a better symbol to drive these checks, but this  
> seems to work for the few CLEARLY UNDERSTOOD endian issues.
>
> It is important for any code that deals with byte packing to be CLEAR  
> about its intentions.  This "it works because alpha is the low byte of  
> an int" stuff can't be sufficient.  More rigorous testing is needed,  
> and developers can't get complacent about assuming that all machines  
> work the same way that their favorite machine works.
>
> * (the current patch being what was passed around unofficially as
>    'dougcorrs.diff' but never got posted on the patch server)
>
> --
> [ e d @ h a l l e y . c c ]
>
>
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list