Files
mruby-mruby/src/value_array.h
T
Yukihiro "Matz" Matsumoto 8813ebec07 Skip array embedding if MRB_NO_BOXING and MRB_32BIT; fix #4382
On some platforms, `sizeof(mrb_value) > sizeof(void*)*3`, which makes
`MRB_ARY_EMBED_LEN_MAX` zero. And zero sized array cause compile errors.
2020-10-12 16:21:36 +09:00

29 lines
440 B
C

#ifndef MRB_VALUE_ARRAY_H__
#define MRB_VALUE_ARRAY_H__
#include <mruby.h>
static inline void
value_move(mrb_value *s1, const mrb_value *s2, size_t n)
{
if (n == 0) return;
if (s1 > s2 && s1 < s2 + n)
{
s1 += n;
s2 += n;
while (n-- > 0) {
*--s1 = *--s2;
}
}
else if (s1 != s2) {
while (n-- > 0) {
*s1++ = *s2++;
}
}
else {
/* nothing to do. */
}
}
#endif /* MRB_VALUE_ARRAY_H__ */