[cairo] Transform+Repeat patch for libpixman

Keith Packard keithp at keithp.com
Tue Oct 12 11:37:35 PDT 2004


Around 11 o'clock on Oct 12, Carl Worth wrote:

> Owen had:
> 
> 	(b) - (-a) % (b)
> 
> which, from the point of view of mathmetical cleanliess, would be better
> as your:
> 
> 	(b) + (a) % (b)

But, as you note, this fails the 'C89' requirement that we use only 
positive numbers on either side of the remainder operator.  Note that the 
fact that C99 places a new requirement on the modulus operator (long 
overdue, in my book), effectively asserts that all machines already work 
this way.  But, as the C99 spec is worthless (being a remainder instead of 
a modulus), we can't use it it without testing anyways, which means we 
might as well just use the positive values and meet the letter of the C89
spec.

Note that returning (b) in these cases actually works in the code, so that
not returning the modulus is ok.

It would, however be nice to get the right answer in all cases.  I think
that's as simple as:

	((b) - (-a - 1) % b) - 1

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20041012/6d8f26ab/attachment.pgp


More information about the cairo mailing list