From f7f5d39f20da61f1a3729a391682e46542d47890 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Thu, 17 Nov 2022 20:41:15 +0100 Subject: [PATCH] fix some cases when comparing floats vs ints --- src/cc65/codegen.c | 24 +++++++++++++++--------- src/cc65/expr.c | 6 ++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index 32e10db1b..38f18c183 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -1553,26 +1553,32 @@ unsigned g_typeadjust (unsigned lhs, unsigned rhs) /* Result is const if both operands are const. */ unsigned const_flag = (lhs & CF_CONST) & (rhs & CF_CONST); - ASMLOG(("nop ; g_typeadjust ltype:%x rtype:%x", ltype, rtype)); // FIXME: remove + LOG((">g_typeadjust ltype:%02x rtype:%02x\n", ltype, rtype)); // FIXME: remove + ASMLOG(("nop ;>g_typeadjust ltype:%02x rtype:%02x", ltype, rtype)); // FIXME: remove /* FIXME: float - this is much much more complicated */ if (ltype == CF_FLOAT && rtype == CF_FLOAT) { // g_regfloat (rhs); - ASMLOG(("nop ; g_typeadjust return:%x float", const_flag | CF_FLOAT)); // FIXME: remove + LOG(("Type)) { + /* Generate code */ + LOG(("hie_compare generate code for Expr as float\n")); + GenFunc (flags, FP_D_As32bitRaw(FP_D_FromInt(Expr2.IVal))); } else { /* Generate code */ + LOG(("hie_compare generate code for Expr2 as int (=%d)\n", Expr2.IVal)); GenFunc (flags, Expr2.IVal); } /* FIXME: float --- newcode end */