diff options
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -7,6 +7,7 @@ #include "st.h" #else #include "ruby/ruby.h" +#include "internal.h" #endif #include <stdio.h> @@ -30,7 +31,9 @@ typedef struct st_packed_entry { st_data_t key, val; } st_packed_entry; -#define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[(expr) ? 1 : -1]; +#ifndef STATIC_ASSERT +#define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[(expr) ? 1 : -1] +#endif #define ST_DEFAULT_MAX_DENSITY 5 #define ST_DEFAULT_INIT_TABLE_SIZE 16 @@ -38,8 +41,8 @@ typedef struct st_packed_entry { #define PACKED_UNIT (int)(sizeof(st_packed_entry) / sizeof(st_table_entry*)) #define MAX_PACKED_HASH (int)(ST_DEFAULT_PACKED_TABLE_SIZE * sizeof(st_table_entry*) / sizeof(st_packed_entry)) -STATIC_ASSERT(st_packed_entry, sizeof(st_packed_entry) == sizeof(st_table_entry*[PACKED_UNIT])) -STATIC_ASSERT(st_packed_bins, sizeof(st_packed_entry[MAX_PACKED_HASH]) <= sizeof(st_table_entry*[ST_DEFAULT_PACKED_TABLE_SIZE])) +STATIC_ASSERT(st_packed_entry, sizeof(st_packed_entry) == sizeof(st_table_entry*[PACKED_UNIT])); +STATIC_ASSERT(st_packed_bins, sizeof(st_packed_entry[MAX_PACKED_HASH]) <= sizeof(st_table_entry*[ST_DEFAULT_PACKED_TABLE_SIZE])); /* * DEFAULT_MAX_DENSITY is the default for the largest we allow the |