Browse Source

* some modifications to -dcardinalmulfix code

Jonas Maebe 25 years ago
parent
commit
858bff5bda
2 changed files with 27 additions and 17 deletions
  1. 17 12
      compiler/nadd.pas
  2. 10 5
      compiler/tcadd.pas

+ 17 - 12
compiler/nadd.pas

@@ -578,23 +578,25 @@ implementation
                    if (porddef(rd)^.typ=u32bit) then
                    if (porddef(rd)^.typ=u32bit) then
                      begin
                      begin
                      { can we make them both unsigned? }
                      { can we make them both unsigned? }
-                       if is_constintnode(left) and
-                          ((treetype <> subn) and
-                           (left^.value > 0)) then
-                         left:=gentypeconvnode(left,u32bitdef)
+                       if (porddef(ld)^.typ in [u8bit,u16bit]) or
+                          (is_constintnode(p^.left) and
+                           (p^.treetype <> subn) and
+                           (p^.left^.value > 0)) then
+                         p^.left:=gentypeconvnode(p^.left,u32bitdef)
                        else
                        else
-                         left:=gentypeconvnode(left,s32bitdef);
-                       firstpass(left);
+                         p^.left:=gentypeconvnode(p^.left,s32bitdef);
+                       firstpass(p^.left);
                      end
                      end
                    else {if (porddef(ld)^.typ=u32bit) then}
                    else {if (porddef(ld)^.typ=u32bit) then}
                      begin
                      begin
                      { can we make them both unsigned? }
                      { can we make them both unsigned? }
-                       if is_constintnode(right) and
-                          (right^.value > 0) then
-                         right:=gentypeconvnode(right,u32bitdef)
+                       if (porddef(rd)^.typ in [u8bit,u16bit]) or
+                          (is_constintnode(p^.right) and
+                           (p^.right^.value > 0)) then
+                         p^.right:=gentypeconvnode(p^.right,u32bitdef)
                        else
                        else
-                         right:=gentypeconvnode(right,s32bitdef);
-                       firstpass(right);
+                         p^.right:=gentypeconvnode(p^.right,s32bitdef);
+                       firstpass(p^.right);
                      end;
                      end;
 {$endif cardinalmulfix}
 {$endif cardinalmulfix}
                  calcregisters(p,1,0,0);
                  calcregisters(p,1,0,0);
@@ -1292,7 +1294,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2000-08-26 12:24:20  florian
+  Revision 1.2  2000-08-29 08:24:45  jonas
+    * some modifications to -dcardinalmulfix code
+
+  Revision 1.1  2000/08/26 12:24:20  florian
     * initial release
     * initial release
 
 
 }
 }

+ 10 - 5
compiler/tcadd.pas

@@ -576,8 +576,9 @@ implementation
                    if (porddef(rd)^.typ=u32bit) then
                    if (porddef(rd)^.typ=u32bit) then
                      begin
                      begin
                      { can we make them both unsigned? }
                      { can we make them both unsigned? }
-                       if is_constintnode(p^.left) and
-                          ((p^.treetype <> subn) and
+                       if (porddef(ld)^.typ in [u8bit,u16bit]) or
+                          (is_constintnode(p^.left) and
+                           (p^.treetype <> subn) and
                            (p^.left^.value > 0)) then
                            (p^.left^.value > 0)) then
                          p^.left:=gentypeconvnode(p^.left,u32bitdef)
                          p^.left:=gentypeconvnode(p^.left,u32bitdef)
                        else
                        else
@@ -587,8 +588,9 @@ implementation
                    else {if (porddef(ld)^.typ=u32bit) then}
                    else {if (porddef(ld)^.typ=u32bit) then}
                      begin
                      begin
                      { can we make them both unsigned? }
                      { can we make them both unsigned? }
-                       if is_constintnode(p^.right) and
-                          (p^.right^.value > 0) then
+                       if (porddef(rd)^.typ in [u8bit,u16bit]) or
+                          (is_constintnode(p^.right) and
+                           (p^.right^.value > 0)) then
                          p^.right:=gentypeconvnode(p^.right,u32bitdef)
                          p^.right:=gentypeconvnode(p^.right,u32bitdef)
                        else
                        else
                          p^.right:=gentypeconvnode(p^.right,s32bitdef);
                          p^.right:=gentypeconvnode(p^.right,s32bitdef);
@@ -1289,7 +1291,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2000-08-27 16:11:54  peter
+  Revision 1.7  2000-08-29 08:24:45  jonas
+    * some modifications to -dcardinalmulfix code
+
+  Revision 1.6  2000/08/27 16:11:54  peter
     * moved some util functions from globals,cobjects to cutils
     * moved some util functions from globals,cobjects to cutils
     * splitted files into finput,fmodule
     * splitted files into finput,fmodule