From: Jérémie Astor Date: Tue, 17 Aug 2021 17:02:45 +0000 (+0200) Subject: :bug: Fix float logical imm X-Git-Tag: nightly~470^2~66 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=28a6fd84491b21830b434ddb8b9aec5b42a9f316;p=gwion.git :bug: Fix float logical imm --- diff --git a/src/lib/prim.c b/src/lib/prim.c index 23ff6459..8de62077 100644 --- a/src/lib/prim.c +++ b/src/lib/prim.c @@ -101,7 +101,7 @@ BINARY_INT_FOLD(or, et_bool, ||,) BINARY_INT_FOLD(eq, et_bool, ==,) BINARY_INT_FOLD(neq, et_bool, !=,) -#define BINARY_OP_EMIT(name, type, member) \ +#define BINARY_OP_EMIT(name, type, member, val) \ static OP_EMIT(opem_##type##_##name) { \ Exp_Binary *const bin = (Exp_Binary *)data; \ if(!is_prim_##type(bin->rhs)) \ @@ -109,12 +109,12 @@ static OP_EMIT(opem_##type##_##name) { \ else { \ const Instr instr = (Instr)vector_back(&emit->code->instr); \ instr->opcode = e##type##_##name##_imm; \ - instr->m_val = bin->rhs->d.prim.d.member; \ + instr->val = bin->rhs->d.prim.d.member; \ } \ return GW_OK; \ } -#define BINARY_INT_EMIT(name) BINARY_OP_EMIT(name, int, num) +#define BINARY_INT_EMIT(name) BINARY_OP_EMIT(name, int, num, m_val) BINARY_INT_EMIT(add) BINARY_INT_EMIT(sub) BINARY_INT_EMIT(mul) @@ -512,7 +512,7 @@ BINARY_FLOAT_FOLD2(ge, et_bool, >=,) BINARY_FLOAT_FOLD2(lt, et_bool, <,) BINARY_FLOAT_FOLD2(le, et_bool, <=,) -#define BINARY_FLOAT_EMIT(name) BINARY_OP_EMIT(name, float, fnum) +#define BINARY_FLOAT_EMIT(name) BINARY_OP_EMIT(name, float, fnum, f) BINARY_FLOAT_EMIT(add) BINARY_FLOAT_EMIT(sub) BINARY_FLOAT_EMIT(mul) diff --git a/src/vm/vm.c b/src/vm/vm.c index 37546c5e..31c23a39 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -336,7 +336,7 @@ ANN static VM_Shred init_fork_shred(const VM_Shred shred, const VM_Code code, #define FLOAT_IMM_LOGICAL(op) \ reg -= SZ_FLOAT - SZ_INT;\ - *(m_uint *)(reg - SZ_INT) = *(m_float*)(reg-SZ_INT+SZ_FLOAT) op FVAL; DISPATCH(); + *(m_uint *)(reg - SZ_INT) = *(m_float*)(reg-SZ_INT) op FVAL; DISPATCH(); #define SELF(t, sz, op) \ *(t *)(reg - sz) = op * (t *)(reg - sz); \