[gegl/samplers] lohalo: use floored division



commit ba4619e132b54896edd713bc32832d1ca24f5168
Author: Nicolas Robidoux <nicolas robidoux gmail com>
Date:   Wed Jun 22 17:07:15 2011 -0400

    lohalo: use floored division

 gegl/buffer/gegl-sampler-lohalo.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-lohalo.c b/gegl/buffer/gegl-sampler-lohalo.c
index 1547d1f..506ca14 100644
--- a/gegl/buffer/gegl-sampler-lohalo.c
+++ b/gegl/buffer/gegl-sampler-lohalo.c
@@ -186,7 +186,7 @@
 
 
 /*
- * A macro for Knuth's floored division:
+ * Macros for Knuth's floored division:
  */
 /* #define LOHALO_FLOORED_DIVISION(a,b) (((a) - ((a)<0 ? (b)-1 : 0)) / (b)) */
 #define LOHALO_FLOORED_DIVISION_BY_2(a) (((a) - ((a)>=0 ? 0 : 1)) / 2)
@@ -2100,7 +2100,8 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
 	    /*
 	     * Find the nearest mipmap anchor pixel location:
 	     */
-	    gint const ix_1 = ix_0 % 2;
+	    gint const ix_1 = LOHALO_FLOORED_DIVISION_BY_2(ix_0);
+	    gint const iy_1 = LOHALO_FLOORED_DIVISION_BY_2(iy_0);
 
 	    /* gint I =  */
 	    



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