{
guint i;
type->enum_map = g_hash_table_new(g_direct_hash, g_direct_equal);
+ type->lowest_value = G_MAXINT32;
+ type->highest_value = G_MININT32;
for(i=0; i<td->labels.position; i++) {
GQuark value = g_quark_from_string((char*)td->labels.array[i]);
gint key = *(int*)td->labels_values.array[i];
g_hash_table_insert(type->enum_map, (gpointer)key, (gpointer)value);
+ type->highest_value = max(key, type->highest_value);
+ type->lowest_value = min(key, type->lowest_value);
}
}
g_assert(type->size != 0);
guint size;
LttTypeEnum type_class; //which type
GHashTable *enum_map; //maps enum labels to numbers.
+ gint32 highest_value; //For enum
+ gint32 lowest_value; //For enum
GArray *fields; // Array of LttFields, for array, sequence, union, struct.
GData *fields_by_name;
guint network; // Is the type in network byte order ?
unsigned ret = 0;
if(likely(t->type_class == LTT_ENUM))
- ret = g_hash_table_size(t->enum_map);
+ // Permits non full enums ret = g_hash_table_size(t->enum_map);
+ ret = (unsigned)(t->highest_value - t->lowest_value);
return ret;
}