diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-13 02:56:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-13 02:56:14 +0000 |
commit | 54af8757b337a7347a230d450cfda9e2b0c94560 (patch) | |
tree | 709753e211aee6f76724c045f360271ecda0fede /st.c | |
parent | 867aafe409b8c8ba8c443d9c0651b804538fa71f (diff) |
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.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 |