Mesa (master): util: Fix unsigned <-> ptr conversions.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Sat Apr 24 15:14:10 UTC 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sat Apr 24 16:13:41 2010 +0100

util: Fix unsigned <-> ptr conversions.

---

 src/gallium/auxiliary/util/u_surfaces.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_surfaces.c b/src/gallium/auxiliary/util/u_surfaces.c
index 0248120..668da8c 100644
--- a/src/gallium/auxiliary/util/u_surfaces.c
+++ b/src/gallium/auxiliary/util/u_surfaces.c
@@ -9,13 +9,13 @@
 static unsigned
 hash(void *key)
 {
-   return (unsigned)key;
+   return (unsigned)(uintptr_t)key;
 }
 
 static int
 compare(void *key1, void *key2)
 {
-   return (unsigned)key1 - (unsigned)key2;
+   return (unsigned)(uintptr_t)key1 - (unsigned)(uintptr_t)key2;
 }
 
 struct pipe_surface *
@@ -67,7 +67,7 @@ util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps)
    struct pipe_resource *pt = ps->texture;
    if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)
    {	/* or 2D array */
-      void* key = (void*)(((ps->zslice + ps->face) << 8) | ps->level);
+      void* key = (void*)(uintptr_t)(((ps->zslice + ps->face) << 8) | ps->level);
       util_hash_table_remove(us->u.table, key);
    }
    else




More information about the mesa-commit mailing list