[gegl] pixelize: remove reliance on implementation-defined behavior in align_offset()



commit c68a5ed5a70a448e9ceeaf63bd8f919266b57e53
Author: thetoastcaper <thetoastcaper gmail com>
Date:   Tue Sep 25 11:07:47 2018 -0400

    pixelize: remove reliance on implementation-defined behavior in align_offset()

 operations/common/pixelize.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/operations/common/pixelize.c b/operations/common/pixelize.c
index 23313c44e..61bd8566c 100644
--- a/operations/common/pixelize.c
+++ b/operations/common/pixelize.c
@@ -93,8 +93,9 @@ static gint
 align_offset (gint offset,
               gint size)
 {
-  offset = offset % size;
-  return offset <= 0 ? (offset * -1) : (size - offset);
+  gint align = abs(offset) % size;
+  
+  return offset <= 0 ? align : (size - align);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]