Forráskód Böngészése

* improved the readability of the code of taddnode.try_make_mul32to64() even
more by factoring out some of the node tests to nested functions

git-svn-id: trunk@26414 -

nickysn 11 éve
szülő
commit
372e9dfdf1
1 módosított fájl, 17 hozzáadás és 8 törlés
  1. 17 8
      compiler/nadd.pas

+ 17 - 8
compiler/nadd.pas

@@ -2526,21 +2526,30 @@ implementation
                     ((v >= qword(low(cardinal))) and (v <= qword(high(cardinal))))
         end;
 
+      function is_32bitordconst(n: tnode): boolean;
+        begin
+          result := (n.nodetype = ordconstn) and
+                    canbe32bitint(tordconstnode(n).value);
+        end;
+
+      function is_32to64typeconv(n: tnode): boolean;
+        begin
+          result := (n.nodetype = typeconvn) and
+                    is_integer(ttypeconvnode(n).left.resultdef) and
+                    not is_64bit(ttypeconvnode(n).left.resultdef);
+        end;
+
       var
         temp: tnode;
       begin
         result := false;
-        if ((left.nodetype = typeconvn) and
-            is_integer(ttypeconvnode(left).left.resultdef) and
-            not is_64bit(ttypeconvnode(left).left.resultdef) and
-           (((right.nodetype = ordconstn) and canbe32bitint(tordconstnode(right).value)) or
-            ((right.nodetype = typeconvn) and
-             is_integer(ttypeconvnode(right).left.resultdef) and
-             not is_64bit(ttypeconvnode(right).left.resultdef)) and
+        if is_32to64typeconv(left) and
+           (is_32bitordconst(right) or
+            is_32to64typeconv(right) and
              ((is_signed(ttypeconvnode(left).left.resultdef) =
                is_signed(ttypeconvnode(right).left.resultdef)) or
               (is_signed(ttypeconvnode(left).left.resultdef) and
-               (torddef(ttypeconvnode(right).left.resultdef).ordtype in [u8bit,u16bit]))))) then
+               (torddef(ttypeconvnode(right).left.resultdef).ordtype in [u8bit,u16bit])))) then
           begin
             temp := ttypeconvnode(left).left;
             ttypeconvnode(left).left := nil;