aboutsummaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-13 02:56:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-13 02:56:14 +0000
commit54af8757b337a7347a230d450cfda9e2b0c94560 (patch)
tree709753e211aee6f76724c045f360271ecda0fede /st.c
parent867aafe409b8c8ba8c443d9c0651b804538fa71f (diff)
downloadruby-54af8757b337a7347a230d450cfda9e2b0c94560.tar.gz
internal.h: STATIC_ASSERT
* st.c: include "internal.h" for STATIC_ASSERT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
-rw-r--r--st.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/st.c b/st.c
index 12e45c27de..e778b69c5a 100644
--- a/st.c
+++ b/st.c
@@ -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