On 08/06/2009 09:00 PM, Nicolas Robidoux wrote:
> Is the use of such tricks discouraged for GEGL (because gfloats could
> be doubles at some point?)
>
> We can take the absolute value by setting the sign bit to zero:
> // Example 13.24
> float f;
> *(int*)&f&= 0x7FFFFFFF; // set sign bit to zero
>
> (From http://www.agner.org/optimize/optimizing_cpp.pdf)

It was an interesting paper, but I doubt that the gained speed in 
execution performance outweights the messier code. Plus, his example was 
to set the sign bit, i.e. x = -abs(x). Maybe x = abs(x) is equal to the 
above for optimizing compilers

  / Martin

-- 

My GIMP Blog:
http://www.chromecode.com/
_______________________________________________
Gegl-developer mailing list
[email protected]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer

Reply via email to