[cairo] _cairo_color_compute_shorts fails with FPU set to
behdad at behdad.org
Wed Aug 30 01:08:27 PDT 2006
On Wed, 2006-08-30 at 09:56 +0200, Alexander Larsson wrote:
> On Wed, 2006-08-30 at 03:45 -0400, Behdad Esfahbod wrote:
> > Or better yet, use what Ali suggests. Or even without a branch:
> > int32_t i;
> > i = f * 65536.0;
> > i -= i == 65536;
> Are you sure this doesn't generate a branch in the assembly? It might be
> able to use a cmov to avoid it, but maybe not.
It's using the comparison result in the subtract AFAIU:
xorl %edx, %edx
movl %esp, %ebp
subl $8, %esp
movzwl -2(%ebp), %eax
movb $12, %ah
movw %ax, -4(%ebp)
movl -8(%ebp), %eax
cmpl $65536, %eax
subl %edx, %eax
convert (double d)
i = d * 65536.0;
i -= i == 65536;
Carl, while you are at it, it may be good to think about what to do
about NANs in color computations. Catching NAN in all color entry
points for example if we're not doing already.
"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
-- Dan Bern, "New American Language"
More information about the cairo