From: Jérémie Astor Date: Wed, 9 Dec 2020 01:50:20 +0000 (+0100) Subject: :art: Improve IntRange X-Git-Tag: nightly~1109 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=67c06b207b4c9d4275816af885bcc72c3c9c81f8;p=gwion.git :art: Improve IntRange --- diff --git a/src/lib/prim.c b/src/lib/prim.c index 87c738fd..e021a104 100644 --- a/src/lib/prim.c +++ b/src/lib/prim.c @@ -59,16 +59,15 @@ static GWION_IMPORT(int_r) { } static INSTR(IntRange) { - shred->reg -= SZ_INT *2; - const m_int start = *(m_int*)REG(0); - const m_int end = *(m_int*)REG(SZ_INT); + shred->reg -= SZ_INT; + const m_int start = *(m_int*)REG(-SZ_INT); + const m_int end = *(m_int*)REG(0); const m_int op = start < end ? 1 : -1; const m_uint sz = op > 0 ? end - start : start - end; const M_Object array = new_array(shred->info->vm->gwion->mp, (Type)instr->m_val, sz); for(m_int i = start, j = 0; i != end; i += op, ++j) m_vector_set(ARRAY(array), j, &i); - *(M_Object*)REG(0) = array; - PUSH_REG(shred, SZ_INT); + *(M_Object*)REG(-SZ_INT) = array; } static OP_CHECK(opck_int_range) {