[cairo] fixed_from_double speedup masking pixman traps problem

Bill Spitzak spitzak at d2.com
Wed Nov 29 12:48:25 PST 2006


In the fast fixed-from-double code, overflow can be detected because the 
"high word" of the resulting double after the math must be a constant. 
If it is not the expected value then overflow occurred and you can then 
use some slower code to do the conversion.

I tried this here but the overhead of the if statement killed most of 
the speed advantage, also investigation of our code indicated that at 
least 90% or so of all calls to our float->int converter was from code 
that already knew the number was in range. So I did not do this. However 
it does appear to be the fastest way to make a flawless converter.

Bogdan Nicula wrote:
> 
> I mentioned before that it's easy to overflow in this function 
> (fixed_from_double) due to errors in  other code. Is it possible to add 
> some input checking?
> 
> Bogdan
> 
> _________________________________________________________________
> Let them discover the world through children's eyes safely withWindows 
> Live OneCare Family Safety. https://fss.live.com/
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
> 


More information about the cairo mailing list