[cairo] fixed_from_double speedup masking pixman traps problem

Behdad Esfahbod behdad at behdad.org
Wed Nov 29 12:56:01 PST 2006


On Wed, 2006-11-29 at 15:48 -0500, Bill Spitzak wrote:
> 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.
> 

So, then adding a variant that returns a overflowed boolean and let the
caller deal with an overflow?

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list