print '#include "main/imports.h"'
print '#include "main/mtypes.h"'
print ''
- print 'typedef struct {'
- print ' size_t offset;'
+ print 'typedef struct PACKED {'
+ print ' uint16_t offset;'
print ' int n;'
print '} enum_elt;'
print ''
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]),
#define NULL 0
#endif
+/* Used to optionally mark structures with misaligned elements or size as
+ * packed, to trade off performance for space.
+ */
+#if (__GNUC__ >= 3)
+#define PACKED __attribute__((__packed__))
+#else
+#define PACKED
+#endif
+
/**
* LONGSTRING macro