Mesa (mesa_7_5_branch): util: Fix 24 to 32 bit expansion binary arithmetic expression.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Tue Jun 2 18:50:50 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: c91df4c1534e2db2274b6d08e90470bf21a49e2a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c91df4c1534e2db2274b6d08e90470bf21a49e2a

Author: José Fonseca <jfonseca at vmware.com>
Date:   Tue Jun  2 11:46:06 2009 -0700

util: Fix 24 to 32 bit expansion binary arithmetic expression.

When approaching y = x * 0xffffffff / 0xffffff with bit arithmetic, the
8 least significant bits of y should come from the
8 most significant bits of x.

---

 src/gallium/auxiliary/util/u_tile.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index f0a5a33..9becd9f 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -1126,7 +1126,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
          for (i = 0; i < h; i++) {
             for (j = 0; j < w; j++) {
                /* convert 24-bit Z to 32-bit Z */
-               pDest[j] = (ptrc[j] << 8) | (ptrc[j] & 0xff);
+               pDest[j] = (ptrc[j] << 8) | ((ptrc[j] >> 16) & 0xff);
             }
             pDest += dstStride;
             ptrc += pt->stride/4;




More information about the mesa-commit mailing list