Merge commit 'origin/gallium-draw-retval'
[mesa.git] / src / gallium / auxiliary / draw / draw_vertex.h
index a943607d7ede7ea69efea7d9bdae5f9714b08378..554f4ac3c18eb81ef764dbb600d1e3df1b8abc6f 100644 (file)
@@ -81,24 +81,23 @@ struct vertex_info
     * memcmp() comparisons.
     */
    struct {
-      ubyte interp_mode:4;      /**< INTERP_x */
-      ubyte emit:4;             /**< EMIT_x */
-      ubyte src_index;          /**< map to post-xform attribs */
+      unsigned interp_mode:4;      /**< INTERP_x */
+      unsigned emit:4;             /**< EMIT_x */
+      unsigned src_index:8;          /**< map to post-xform attribs */
    } attrib[PIPE_MAX_SHADER_INPUTS];
 };
 
-static INLINE int
+static INLINE size_t
 draw_vinfo_size( const struct vertex_info *a )
 {
-   return ((const char *)&a->attrib[a->num_attribs] -
-           (const char *)a);
+   return offsetof(const struct vertex_info, attrib[a->num_attribs]);
 }
 
 static INLINE int
 draw_vinfo_compare( const struct vertex_info *a,
                     const struct vertex_info *b )
 {
-   unsigned sizea = draw_vinfo_size( a );
+   size_t sizea = draw_vinfo_size( a );
    return memcmp( a, b, sizea );
 }
 
@@ -106,7 +105,7 @@ static INLINE void
 draw_vinfo_copy( struct vertex_info *dst,
                  const struct vertex_info *src )
 {
-   unsigned size = draw_vinfo_size( src );
+   size_t size = draw_vinfo_size( src );
    memcpy( dst, src, size );
 }