]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Generate (non_const_float * (1.0 / constant_float)) for (non_const_float / constant_f...
authorDale Weiler <killfieldengine@gmail.com>
Wed, 18 Sep 2013 23:15:24 +0000 (19:15 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Wed, 18 Sep 2013 23:15:24 +0000 (19:15 -0400)
fold.c
misc/xonotic_export.sh [changed mode: 0644->0755]

diff --git a/fold.c b/fold.c
index 98e637ae0e62177fe580fbcb180495898d3e3540..32eeae625670c87fc246eae863c616c74e952346 100644 (file)
--- a/fold.c
+++ b/fold.c
@@ -386,7 +386,7 @@ static GMQCC_INLINE ast_expression *fold_op_mul_vec(fold_t *fold, vec3_t vec, as
         out                        = (ast_expression*)ast_member_new(fold_ctx(fold), (ast_expression*)sel, set[0]-'x', NULL);
         out->node.keep             = false;
         ((ast_member*)out)->rvalue = true;
-        if (x != -1)
+        if (x != -1.0f)
             return (ast_expression*)ast_binary_new(fold_ctx(fold), INSTR_MUL_F, fold_constgen_float(fold, x), out);
     }
     return NULL;
@@ -483,6 +483,13 @@ static GMQCC_INLINE ast_expression *fold_op_div(fold_t *fold, ast_value *a, ast_
                 return fold_constgen_float(fold, fold_immvalue_float(a) / fold_immvalue_float(b));
             else
                 return (ast_expression*)fold->imm_float[3]; /* inf */
+        } else if (fold_can_1(b)) {
+            return (ast_expression*)ast_binary_new(
+                fold_ctx(fold),
+                INSTR_MUL_F,
+                (ast_expression*)a,
+                fold_constgen_float(fold, 1.0f / fold_immvalue_float(b))
+            );
         }
     } else if (isvector(a)) {
         if (fold_can_2(a, b)) {
old mode 100644 (file)
new mode 100755 (executable)
index 08f0355..f1413ca
@@ -35,8 +35,14 @@ rm -f i18n-guide.txt
 rm -rf server-testcase
 rm -f Makefile
 rm -f *.src
+rm -f qccversion.*
 echo "complete"
 
+cat client/progs.src | sed "s/\.\.\///" > csprogs.src
+cat server/progs.src | sed "s/\.\.\///" > progs.src
+cat menu/progs.src | sed "s/\.\.\///" > menu.src
+
+
 echo -n "creating zip archive ... "
 zip -r -9 ../xonotic.zip * > /dev/null
 echo "complete"