summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-06-16 08:48:12 -0600
committerBrian Paul <brianp@vmware.com>2009-06-17 11:30:04 -0600
commit84943a2aca3e69f89b8bc5bbfc585d3a35e44cf4 (patch)
tree9edd9e7fc8e433f4356fb5af97f8de39d296d972
parentb83c9ecef41dc329c34aca722cb08339592a8be0 (diff)
mesa: fix REMAINDER() macro
The results were incorrect for some negative values of A. See bug 21872. (cherry picked from mesa_7_5_branch, commit ed7f4b42307bff4633689d6781cd3643f10041e5)
-rw-r--r--src/mesa/swrast/s_texfilter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index fce0bcf0ca..f86dbdb23a 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -226,7 +226,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c,
* If A is a signed integer, A % B doesn't give the right value for A < 0
* (in terms of texture repeat). Just casting to unsigned fixes that.
*/
-#define REMAINDER(A, B) ((unsigned) (A) % (unsigned) (B))
+#define REMAINDER(A, B) (((A) + (B) * 1024) % (B))
/**