vendor/mruby-source/src/value_array.h
raw| 1 | #ifndef MRB_VALUE_ARRAY_H__ |
| 2 | #define MRB_VALUE_ARRAY_H__ |
| 3 | |
| 4 | #include <mruby.h> |
| 5 | |
| 6 | static inline void |
| 7 | value_move(mrb_value *s1, const mrb_value *s2, size_t n) |
| 8 | { |
| 9 | if (n == 0) return; |
| 10 | if (s1 > s2 && s1 < s2 + n) |
| 11 | { |
| 12 | s1 += n; |
| 13 | s2 += n; |
| 14 | while (n-- > 0) { |
| 15 | *--s1 = *--s2; |
| 16 | } |
| 17 | } |
| 18 | else if (s1 != s2) { |
| 19 | while (n-- > 0) { |
| 20 | *s1++ = *s2++; |
| 21 | } |
| 22 | } |
| 23 | else { |
| 24 | /* nothing to do. */ |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | #endif /* MRB_VALUE_ARRAY_H__ */ |