mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 12:20:28 +02:00
* don't change sign for unsigned shl/shr operations
* cleanup for u32bit
This commit is contained in:
parent
726b980f38
commit
c25228226d
@ -772,44 +772,29 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
if is_signed(ld) and
|
||||
{ then rd = u32bit }
|
||||
{ convert positive constants to u32bit }
|
||||
not(is_constintnode(left) and
|
||||
(tordconstnode(left).value >= 0)) then
|
||||
{ convert positive constants to u32bit }
|
||||
if (torddef(ld).typ<>u32bit) and
|
||||
is_constintnode(left) and
|
||||
(tordconstnode(left).value >= 0) then
|
||||
inserttypeconv(left,u32inttype);
|
||||
if (torddef(rd).typ<>u32bit) and
|
||||
is_constintnode(right) and
|
||||
(tordconstnode(right).value >= 0) then
|
||||
inserttypeconv(right,u32inttype);
|
||||
{ when one of the operand is signed perform
|
||||
the operation in 64bit }
|
||||
if is_signed(ld) or is_signed(rd) then
|
||||
begin
|
||||
{ perform the operation in 64bit }
|
||||
CGMessage(type_w_mixed_signed_unsigned);
|
||||
inserttypeconv(left,s64inttype);
|
||||
inserttypeconv(right,s64inttype);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if is_signed(ld) and
|
||||
not(is_constintnode(left) and
|
||||
(tordconstnode(left).value >= 0)) then
|
||||
CGMessage(type_w_mixed_signed_unsigned2);
|
||||
inserttypeconv(left,u32inttype);
|
||||
|
||||
if is_signed(rd) and
|
||||
{ then ld = u32bit }
|
||||
{ convert positive constants to u32bit }
|
||||
not(is_constintnode(right) and
|
||||
(tordconstnode(right).value >= 0)) then
|
||||
begin
|
||||
{ perform the operation in 64bit }
|
||||
CGMessage(type_w_mixed_signed_unsigned);
|
||||
inserttypeconv(left,s64inttype);
|
||||
inserttypeconv(right,s64inttype);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if is_signed(rd) and
|
||||
not(is_constintnode(right) and
|
||||
(tordconstnode(right).value >= 0)) then
|
||||
CGMessage(type_w_mixed_signed_unsigned2);
|
||||
inserttypeconv(right,u32inttype);
|
||||
end;
|
||||
if (torddef(ld).typ<>u32bit) then
|
||||
inserttypeconv(left,u32inttype);
|
||||
if (torddef(rd).typ<>u32bit) then
|
||||
inserttypeconv(right,u32inttype);
|
||||
end;
|
||||
end;
|
||||
end
|
||||
@ -1952,7 +1937,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.117 2004-04-29 19:56:37 daniel
|
||||
Revision 1.118 2004-05-19 23:29:26 peter
|
||||
* don't change sign for unsigned shl/shr operations
|
||||
* cleanup for u32bit
|
||||
|
||||
Revision 1.117 2004/04/29 19:56:37 daniel
|
||||
* Prepare compiler infrastructure for multiple ansistring types
|
||||
|
||||
Revision 1.116 2004/04/18 07:52:43 florian
|
||||
|
@ -171,11 +171,10 @@ implementation
|
||||
if (rd.typ in [u32bit,u64bit]) and
|
||||
is_constintnode(left) and
|
||||
(tordconstnode(left).value >= 0) then
|
||||
inserttypeconv(left,right.resulttype)
|
||||
else
|
||||
if (ld.typ in [u32bit,u64bit]) and
|
||||
is_constintnode(right) and
|
||||
(tordconstnode(right).value >= 0) then
|
||||
inserttypeconv(left,right.resulttype);
|
||||
if (ld.typ in [u32bit,u64bit]) and
|
||||
is_constintnode(right) and
|
||||
(tordconstnode(right).value >= 0) then
|
||||
inserttypeconv(right,left.resulttype);
|
||||
|
||||
{ when there is one currency value, everything is done
|
||||
@ -454,13 +453,16 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
|
||||
{ expand to cpu wordsize, but don't change sign. For
|
||||
32bit ignore 64bit since that has it's own code }
|
||||
{$ifndef cpu64bit}
|
||||
{ 64 bit ints have their own shift handling }
|
||||
if not is_64bit(left.resulttype.def) then
|
||||
{$endif cpu64bit}
|
||||
{$endif}
|
||||
begin
|
||||
if torddef(left.resulttype.def).typ<>torddef(uinttype.def).typ then
|
||||
inserttypeconv(left,sinttype);
|
||||
if is_signed(left.resulttype.def) then
|
||||
inserttypeconv(left,sinttype)
|
||||
else
|
||||
inserttypeconv(left,uinttype);
|
||||
end;
|
||||
|
||||
inserttypeconv(right,sinttype);
|
||||
@ -852,7 +854,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.61 2004-03-29 14:44:10 peter
|
||||
Revision 1.62 2004-05-19 23:29:25 peter
|
||||
* don't change sign for unsigned shl/shr operations
|
||||
* cleanup for u32bit
|
||||
|
||||
Revision 1.61 2004/03/29 14:44:10 peter
|
||||
* fixes to previous constant integer commit
|
||||
|
||||
Revision 1.60 2004/03/23 22:34:49 peter
|
||||
|
Loading…
Reference in New Issue
Block a user