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

Author: José Fonseca <[email protected]>
Date:   Thu Jun 18 14:46:45 2009 +0100

draw: Replace pointer arithmetic with cast.

Using uintptr_t as intermediate type for pointer -> integer conversions is
easier to understand and does not cause any size mismatch warnings.
uintptr_t is part of C99, and we already provide a suitable replacement
definition for all platforms we care about.

---

 src/gallium/auxiliary/draw/draw_pt_elts.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_elts.c 
b/src/gallium/auxiliary/draw/draw_pt_elts.c
index b7780fb..88f4d9f 100644
--- a/src/gallium/auxiliary/draw/draw_pt_elts.c
+++ b/src/gallium/auxiliary/draw/draw_pt_elts.c
@@ -54,7 +54,8 @@ static unsigned elt_ubyte( const void *elts, unsigned idx )
 
 static unsigned elt_vert( const void *elts, unsigned idx )
 {
-   return (const ubyte *)elts - (const ubyte *)NULL + idx;
+   /* unsigned index is packed in the pointer */
+   return (unsigned)(uintptr_t)elts + idx;
 }
 
 pt_elt_func draw_pt_elt_func( struct draw_context *draw )

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to