[Mesa-dev] [PATCH 09/10] glsl: Swap the order of glsl_type::name and ::length

Ian Romanick idr at freedesktop.org
Mon Nov 3 16:23:00 PST 2014


From: Ian Romanick <ian.d.romanick at intel.com>

On x86-64 this saves 8 bytes of padding in the structure, and this
reduces the size of the structure to 32 bytes.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/glsl_types.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 096f546..474b129 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -158,13 +158,6 @@ struct glsl_type {
    /*@}*/
 
    /**
-    * Name of the data type
-    *
-    * Will never be \c NULL.
-    */
-   const char *name;
-
-   /**
     * For \c GLSL_TYPE_ARRAY, this is the length of the array.  For
     * \c GLSL_TYPE_STRUCT or \c GLSL_TYPE_INTERFACE, it is the number of
     * elements in the structure and the number of values pointed to by
@@ -173,6 +166,13 @@ struct glsl_type {
    unsigned length;
 
    /**
+    * Name of the data type
+    *
+    * Will never be \c NULL.
+    */
+   const char *name;
+
+   /**
     * Subtype of composite data types.
     */
    union {
-- 
1.8.1.4



More information about the mesa-dev mailing list