[Gegl-developer] gegl-demo & region of interest
Øyvind Kolås
pippin at gimp.org
Tue Jun 27 17:46:52 PDT 2006
On 6/27/06, Richard Kralovic <Richard.Kralovic at inf.ethz.ch> wrote:
> I changed the definition of REMAINDER to this:
> #define REMAINDER(dividend, divisor) \
> ((((dividend)%(divisor) < 0) ? \
> (divisor) - ((-(dividend)) % (divisor)) : \
> ((dividend) % (divisor))))
> Is this the right fix?
The new version of the tile_offset function (earlier toff) using the
REMAINDER macro is indeed buggy. Your fix is almost correct, the
coorect fix was:
#define REMAINDER(dividend, divisor) \
((((dividend) < 0) ? \
((divisor) - ((-(dividend)) % (divisor))) % (divisor) : \
((dividend) % (divisor))))
(the whole point of this macro is that the result of %'ing a negative
number is not defined in C, thus using it in the computation doesn't
seem the right thing to do ;)
/Øyvind K.
--
«The future is already here. It's just not very evenly distributed»
-- William Gibson
http://pippin.gimp.org/ http://ffii.org/
More information about the Gegl-developer
mailing list