Browse Source

* Fix browcol.
- Remove another obsolete uint64 test.

git-svn-id: trunk@7659 -

daniel 18 years ago
parent
commit
7934961490
2 changed files with 9 additions and 18 deletions
  1. 4 4
      compiler/browcol.pas
  2. 5 14
      compiler/nadd.pas

+ 4 - 4
compiler/browcol.pas

@@ -1456,16 +1456,16 @@ end;
       constord :
         begin
           if sym.constdef.typ=enumdef then
-            Name:=sym.constdef.typesym.name+'('+IntToStr(sym.value.valueord)+')'
+            Name:=sym.constdef.typesym.name+'('+tostr(sym.value.valueord)+')'
           else
             if is_boolean(sym.constdef) then
-              Name:='Longbool('+IntToStr(sym.value.valueord)+')'
+              Name:='Longbool('+tostr(sym.value.valueord)+')'
           else
             if is_char(sym.constdef) or
                is_widechar(sym.constdef) then
-              Name:=''''+chr(sym.value.valueord)+''''
+              Name:=''''+chr(sym.value.valueord.svalue)+''''
           else
-            Name:=IntToStr(sym.value.valueord);
+            Name:=tostr(sym.value.valueord);
         end;
       constresourcestring,
       conststring :

+ 5 - 14
compiler/nadd.pas

@@ -2122,18 +2122,10 @@ implementation
 
     function taddnode.try_make_mul32to64: boolean;
 
-      function canbe32bitint(v: tconstexprint; fromdef: torddef; todefsigned: boolean): boolean;
+      function canbe32bitint(v: tconstexprint): boolean;
         begin
-          if (fromdef.ordtype <> u64bit) then
-            result :=
-             ((v >= 0) or
-              todefsigned) and
-             (v >= int64(low(longint))) and
-             (v <= int64(high(longint)))
-          else
-            result :=
-             (qword(v) >= low(cardinal)) and
-             (qword(v) <= high(cardinal))
+          result := ((v >= int64(low(longint))) and (v <= int64(high(longint)))) or
+                    ((v >= qword(low(cardinal))) and (v <= qword(high(cardinal))))
         end;
 
       var
@@ -2142,9 +2134,8 @@ implementation
         result := false;
         if ((left.nodetype = typeconvn) and
             is_integer(ttypeconvnode(left).left.resultdef) and
-            (not(torddef(ttypeconvnode(left).left.resultdef).ordtype in [u64bit,s64bit]))  and
-           (((right.nodetype = ordconstn) and
-             canbe32bitint(tordconstnode(right).value,torddef(right.resultdef),is_signed(left.resultdef))) or
+            (not(torddef(ttypeconvnode(left).left.resultdef).ordtype in [u64bit,s64bit])) and
+           (((right.nodetype = ordconstn) and canbe32bitint(tordconstnode(right).value)) or
             ((right.nodetype = typeconvn) and
              is_integer(ttypeconvnode(right).left.resultdef) and
              not(torddef(ttypeconvnode(right).left.resultdef).ordtype in [u64bit,s64bit])) and