Commit 23edcef0 authored by Cristy's avatar Cristy

...

parent 84a87f7a
...@@ -2682,21 +2682,13 @@ static inline MagickModulo VirtualPixelModulo(const ssize_t offset, ...@@ -2682,21 +2682,13 @@ static inline MagickModulo VirtualPixelModulo(const ssize_t offset,
MagickModulo MagickModulo
modulo; modulo;
/* modulo.quotient=offset/((ssize_t) extent);
Compute the remainder of dividing offset by extent. It returns not only modulo.remainder=offset % ((ssize_t) extent);
the quotient (tile the offset falls in) but also the positive remainer if ((modulo.remainder != 0) && ((offset ^ ((ssize_t) extent)) < 0))
within that tile such that 0 <= remainder < extent. This method is {
essentially a ldiv() using a floored modulo division rather than the modulo.quotient-=1;
normal default truncated modulo division. modulo.remainder+=((ssize_t) extent);
*/ }
modulo.quotient=offset/(ssize_t) extent;
if ((offset < 0L) && (modulo.quotient > (ssize_t) (-SSIZE_MAX)))
modulo.quotient--;
modulo.remainder=(ssize_t) (offset-(double) modulo.quotient*extent);
if ((offset < 0L) && (modulo.quotient > (ssize_t) (-SSIZE_MAX)))
modulo.quotient--;
if (modulo.remainder == (ssize_t) extent)
modulo.remainder--;
return(modulo); return(modulo);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment