]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Mage inexact travel across constants.
authorDale Weiler <weilercdale@gmail.com>
Sat, 24 May 2014 15:50:16 +0000 (11:50 -0400)
committerDale Weiler <weilercdale@gmail.com>
Sat, 24 May 2014 15:50:16 +0000 (11:50 -0400)
fold.c
parser.c

diff --git a/fold.c b/fold.c
index aca45c0a6cd765b44b4fd46b8a630cd77665038c..8227537bc68f20793b45fcf199c7f35146966341 100644 (file)
--- a/fold.c
+++ b/fold.c
@@ -692,7 +692,6 @@ ast_expression *fold_constgen_float(fold_t *fold, qcfloat_t value, bool inexact)
     out->hasvalue        = true;
     out->inexact         = inexact;
     out->constval.vfloat = value;
-    (void)inexact;
 
     vec_push(fold->imm_float, out);
 
@@ -923,11 +922,7 @@ static GMQCC_INLINE ast_expression *fold_op_div(fold_t *fold, ast_value *a, ast_
     if (isfloat(a)) {
         if (fold_can_2(a, b)) {
             bool inexact = fold_check_except_float(&sfloat_div, fold, a, b);
-            ast_expression *e;
-            con_out("inexact: %d (%x:%x)\n", inexact, a, b);
-            e = fold_constgen_float(fold, fold_immvalue_float(a) / fold_immvalue_float(b), inexact);
-            con_out("%x\n", e);
-            return e;
+            return fold_constgen_float(fold, fold_immvalue_float(a) / fold_immvalue_float(b), inexact);
         } else if (fold_can_1(b)) {
             return (ast_expression*)ast_binary_new(
                 fold_ctx(fold),
@@ -1083,7 +1078,6 @@ static GMQCC_INLINE ast_expression *fold_op_cmp(fold_t *fold, ast_value *a, ast_
         if (isfloat(a) && isfloat(b)) {
             float la = fold_immvalue_float(a);
             float lb = fold_immvalue_float(b);
-            con_out("CMP: %x:%x\n", a, b);
             fold_check_inexact_float(fold, a, b);
             return (ast_expression*)fold->imm_float[!(ne ? la == lb : la != lb)];
         } if (isvector(a) && isvector(b)) {
index 354ad0355e7912cd9755fc900d00b32b817ef51c..00f8dfd7c4db44706ce731f8cff3eb4417da0312 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5842,6 +5842,7 @@ skipvar:
                     else
                     {
                         var->hasvalue = true;
+                        var->inexact  = ((ast_value*)cexp)->inexact;
                         if (cval->expression.vtype == TYPE_STRING)
                             var->constval.vstring = parser_strdup(cval->constval.vstring);
                         else if (cval->expression.vtype == TYPE_FIELD)