]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
This is easier
authorDale Weiler <killfieldengine@gmail.com>
Sat, 15 Jun 2013 09:53:12 +0000 (09:53 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 15 Jun 2013 09:53:12 +0000 (09:53 +0000)
parser.c

index c92e51c9b005bbcee77bb378ac57de3d2dfc7222..b53dba5ec5b9df6055eebd0789ac07a5d1a4f0b6 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1041,22 +1041,12 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
              * whole process ends up becoming:
              * (LHS | RHS) & (-1 - (LHS & RHS))
              */
-            #define TRY_TYPE(I)                                       \
-                if (exprs[(I)]->vtype != TYPE_FLOAT) {                \
-                    ast_type_to_string(exprs[(I)], ty1, sizeof(ty1)); \
-                    compile_error (                                   \
-                        ast_ctx(exprs[(I)]),                          \
-                        "invalid type `%s` for bit-xor in %s",        \
-                        ty1,                                          \
-                        ((I) == 0)                                    \
-                            ? "left-hand-side of expression"          \
-                            : "right-hand-side of expression"         \
-                    );                                                \
-                    return false;                                     \
-                }
-            TRY_TYPE(0)
-            TRY_TYPE(1)
-            #undef TRY_TYPE
+            if (NotSameType(TYPE_FLOAT)) {
+                compile_error(ctx, "invalid types used in expression: cannot perform bit operations between types %s and %s",
+                              type_name[exprs[0]->vtype],
+                              type_name[exprs[1]->vtype]);
+                return false;
+            }
 
             if(CanConstFold(exprs[0], exprs[1])) {
                 out = (ast_expression*)parser_const_float(parser, (float)((qcint)(ConstF(0)) ^ ((qcint)(ConstF(1)))));