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