pixman-combine-float.c: Use IS_ZERO() in clip_color() and set_sat()
authorSøren Sandmann Pedersen <ssp@redhat.com>
Fri, 18 Jan 2013 19:13:21 +0000 (14:13 -0500)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 29 Jan 2013 20:23:05 +0000 (15:23 -0500)
commit1fa67f499d3826fad8783684bb90c8aadd9f682f
tree02fde397e3d0da8c82376affca946ad5e77ee01a
parent7e53e5866458fe592fc109cb1455c21c4b61dee9
pixman-combine-float.c: Use IS_ZERO() in clip_color() and set_sat()

The clip_color() function has some checks to avoid division by zero,
but they are done by comparing the value to 4 * FLT_EPSILON, where a
better choice is the IS_ZERO() macro that compares to +/- FLT_MIN.

In set_sat(), the check is that *max > *min before dividing by *max -
*min, but that has the potential problem that interactions between GCC
optimizions and 80 bit x87 registers could mean that (*max > *min) is
true in 80 bits, but (*max - *min) is 0 in 32 bits, so that the
division by zero is not prevented. Using IS_ZERO() here as well
prevents this.
pixman/pixman-combine-float.c