[Mesa-dev] [PATCH 3/7] mesa: Shrink the size of the enum string lookup struct.
Eric Anholt
eric at anholt.net
Fri Sep 20 18:52:21 PDT 2013
Since it's only used for debug information, we can misalign the struct and
save the disk space. Another 19k on a 64-bit build.
---
src/mapi/glapi/gen/gl_enums.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index e1ab600..6f54b06 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -47,8 +47,8 @@ class PrintGlEnums(gl_XML.gl_print_base):
print '#include "main/imports.h"'
print '#include "main/mtypes.h"'
print ''
- print 'typedef struct {'
- print ' size_t offset;'
+ print 'typedef struct __attribute__((__packed__)) {'
+ print ' uint16_t offset;'
print ' int n;'
print '} enum_elt;'
print ''
@@ -78,6 +78,8 @@ static char token_tmp[20];
const char *_mesa_lookup_enum_by_nr( int nr )
{
+ STATIC_ASSERT(sizeof(enum_string_table) < (1 << 16));
+
enum_elt *elt = _mesa_bsearch(& nr, enum_string_table_offsets,
Elements(enum_string_table_offsets),
sizeof(enum_string_table_offsets[0]),
--
1.8.4.rc3
More information about the mesa-dev
mailing list