From 09336c5d49481d56587f6e28924014954b4c8dd2 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sun, 3 Oct 2021 17:14:00 +0900 Subject: mruby/ops.h: add new instructions `OP_GETIDX` and `OP_SETIDX`. Which represent `obj[int]` and `obj[int]=val` respectively where `obj` is either `string`, `array` or `hash`, so that index access could be faster. When `obj` is not assumed type or `R(a+1)` is not integer, the instructions fallback to method calls. --- src/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/string.c') diff --git a/src/string.c b/src/string.c index ac0f4a920..089c8616c 100644 --- a/src/string.c +++ b/src/string.c @@ -1146,7 +1146,7 @@ range_arg: return STR_OUT_OF_RANGE; } -static mrb_value +mrb_value mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value indx, mrb_value alen) { mrb_int beg, len; -- cgit v1.2.3