diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-04 12:33:07 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-04 12:33:07 +0900 |
| commit | d6cb4f9cf2027eb20f67238aa6c051448602e7e6 (patch) | |
| tree | c025d53534298097aadc3d7699de964bd8a7225f /src/hash.c | |
| parent | 388d26d77027feaa3e107abf7209e2681868bbe6 (diff) | |
| parent | a751f7f196e35cf85ac6f5c0d855edeb68b2bf53 (diff) | |
| download | mruby-d6cb4f9cf2027eb20f67238aa6c051448602e7e6.tar.gz mruby-d6cb4f9cf2027eb20f67238aa6c051448602e7e6.zip | |
Merge branch 'pandax381-mrb_without_float'
Diffstat (limited to 'src/hash.c')
| -rw-r--r-- | src/hash.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hash.c b/src/hash.c index 53ef2b818..27d481947 100644 --- a/src/hash.c +++ b/src/hash.c @@ -12,8 +12,10 @@ #include <mruby/string.h> #include <mruby/variable.h> +#ifndef MRB_WITHOUT_FLOAT /* a function to get hash value of a float number */ mrb_int mrb_float_id(mrb_float f); +#endif static inline khint_t mrb_hash_ht_hash_func(mrb_state *mrb, mrb_value key) @@ -31,7 +33,9 @@ mrb_hash_ht_hash_func(mrb_state *mrb, mrb_value key) case MRB_TT_FALSE: case MRB_TT_SYMBOL: case MRB_TT_FIXNUM: +#ifndef MRB_WITHOUT_FLOAT case MRB_TT_FLOAT: +#endif h = (khint_t)mrb_obj_id(key); break; @@ -60,12 +64,15 @@ mrb_hash_ht_hash_equal(mrb_state *mrb, mrb_value a, mrb_value b) switch (mrb_type(b)) { case MRB_TT_FIXNUM: return mrb_fixnum(a) == mrb_fixnum(b); +#ifndef MRB_WITHOUT_FLOAT case MRB_TT_FLOAT: return (mrb_float)mrb_fixnum(a) == mrb_float(b); +#endif default: return FALSE; } +#ifndef MRB_WITHOUT_FLOAT case MRB_TT_FLOAT: switch (mrb_type(b)) { case MRB_TT_FIXNUM: @@ -75,6 +82,7 @@ mrb_hash_ht_hash_equal(mrb_state *mrb, mrb_value a, mrb_value b) default: return FALSE; } +#endif default: return mrb_eql(mrb, a, b); |
