Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/vm/instructions.rb b/vm/instructions.rb
- index 92c9c0c..9f2d349 100644
- --- a/vm/instructions.rb
- +++ b/vm/instructions.rb
- @@ -3829,23 +3829,10 @@ class Instructions
- def shift_array
- <<-CODE
- Array* array = as<Array>(stack_pop());
- - size_t size = (size_t)array->size();
- - if(size == 0) {
- - stack_push(array);
- - stack_push(Qnil);
- - } else {
- - size_t j = size - 1;
- - Object* shifted_value = array->get(state, 0);
- - Array* smaller_array = Array::create(state, j);
- -
- - for(size_t i = 0; i < j; i++) {
- - smaller_array->set(state, i, array->get(state, i+1));
- - }
- -
- - stack_push(smaller_array);
- - stack_push(shifted_value);
- - }
- + Object *val = array->shift(state);
- + stack_push(array);
- + stack_push(val);
- CODE
- end
Add Comment
Please, Sign In to add comment