summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-09-26 22:23:27 +0900
committerKOBAYASHI Shuji <[email protected]>2019-09-26 22:23:27 +0900
commitfeaf80d8996340bd0316fda72418b1abd774bd59 (patch)
tree43801fcc666b937f60086b0d51271bb28eab1cc0 /mrbgems/mruby-compiler/core/codegen.c
parent60cc46a92cf93f408dac22658c6a206e882e0e04 (diff)
downloadmruby-feaf80d8996340bd0316fda72418b1abd774bd59.tar.gz
mruby-feaf80d8996340bd0316fda72418b1abd774bd59.zip
Use type predicate macros instead of `mrb_type` if possible
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for all `enum mrb_vtype`).
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 1989c0cf1..0af76bd17 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -559,7 +559,7 @@ new_lit(codegen_scope *s, mrb_value val)
mrb_int len;
pv = &s->irep->pool[i];
- if (mrb_type(*pv) != MRB_TT_STRING) continue;
+ if (!mrb_string_p(*pv)) continue;
if ((len = RSTRING_LEN(*pv)) != RSTRING_LEN(val)) continue;
if (memcmp(RSTRING_PTR(*pv), RSTRING_PTR(val), len) == 0)
return i;
@@ -570,7 +570,7 @@ new_lit(codegen_scope *s, mrb_value val)
for (i=0; i<s->irep->plen; i++) {
mrb_float f1, f2;
pv = &s->irep->pool[i];
- if (mrb_type(*pv) != MRB_TT_FLOAT) continue;
+ if (!mrb_float_p(*pv)) continue;
f1 = mrb_float(*pv);
f2 = mrb_float(val);
if (f1 == f2 && !signbit(f1) == !signbit(f2)) return i;