]> Nishi Git Mirror - gwion.git/commitdiff
:bug: Fix float logical imm
authorJérémie Astor <fennecdjay@gmail.com>
Tue, 17 Aug 2021 17:02:45 +0000 (19:02 +0200)
committerJérémie Astor <fennecdjay@gmail.com>
Tue, 17 Aug 2021 17:02:45 +0000 (19:02 +0200)
src/lib/prim.c
src/vm/vm.c

index 23ff6459bc274a6d0d5a27cf5f27b5bc8b507fd9..8de62077692c760eac863c46aea08197c5d6764d 100644 (file)
@@ -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)
index 37546c5eb8d0cf9a6a1b6a5220628e9ee6525342..31c23a392122d04e91aa59b4feb57dd7a3026fa3 100644 (file)
@@ -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);                                     \