Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
#include <stdint.h>
#include <glib.h>
#include <stdint.h>
#include <glib.h>
+#if (__LONG_MAX__ == 2147483647L)
+#define WORD_SIZE 32
+#elif (__LONG_MAX__ == 9223372036854775807L)
+#define WORD_SIZE 64
+#else
+#error "Unknown long size."
+#endif
+
static
struct definition *_enum_definition_new(struct declaration *declaration,
struct definition_scope *parent_scope,
static
struct definition *_enum_definition_new(struct declaration *declaration,
struct definition_scope *parent_scope,
static inline
gpointer get_uint_v(uint64_t *v)
{
static inline
gpointer get_uint_v(uint64_t *v)
{
-#else /* __WORDSIZE != 32 */
+#else /* WORD_SIZE != 32 */
static inline
gpointer get_uint_v(uint64_t *v)
{
static inline
gpointer get_uint_v(uint64_t *v)
{
void enum_val_free(void *ptr)
{
}
void enum_val_free(void *ptr)
{
}
-#endif /* __WORDSIZE != 32 */
+#endif /* WORD_SIZE != 32 */
/*
* Returns a GArray or NULL.
/*
* Returns a GArray or NULL.
array = g_array_sized_new(FALSE, TRUE, sizeof(GQuark), 1);
g_array_set_size(array, 1);
g_array_index(array, GQuark, array->len - 1) = q;
array = g_array_sized_new(FALSE, TRUE, sizeof(GQuark), 1);
g_array_set_size(array, 1);
g_array_index(array, GQuark, array->len - 1) = q;
valuep = g_new(uint64_t, 1);
*valuep = v;
valuep = g_new(uint64_t, 1);
*valuep = v;
-#else /* __WORDSIZE != 32 */
+#else /* WORD_SIZE != 32 */
-#endif /* __WORDSIZE != 32 */
+#endif /* WORD_SIZE != 32 */
g_hash_table_insert(enum_declaration->table.value_to_quark_set, valuep, array);
} else {
g_array_set_size(array, array->len + 1);
g_hash_table_insert(enum_declaration->table.value_to_quark_set, valuep, array);
} else {
g_array_set_size(array, array->len + 1);
array = g_array_sized_new(FALSE, TRUE, sizeof(GQuark), 1);
g_array_set_size(array, 1);
g_array_index(array, GQuark, array->len - 1) = q;
array = g_array_sized_new(FALSE, TRUE, sizeof(GQuark), 1);
g_array_set_size(array, 1);
g_array_index(array, GQuark, array->len - 1) = q;
valuep = g_new(int64_t, 1);
*valuep = v;
valuep = g_new(int64_t, 1);
*valuep = v;
-#else /* __WORDSIZE != 32 */
+#else /* WORD_SIZE != 32 */
-#endif /* __WORDSIZE != 32 */
+#endif /* WORD_SIZE != 32 */
g_hash_table_insert(enum_declaration->table.value_to_quark_set, valuep, array);
} else {
g_array_set_size(array, array->len + 1);
g_hash_table_insert(enum_declaration->table.value_to_quark_set, valuep, array);
} else {
g_array_set_size(array, array->len + 1);