mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-07 08:19:26 +01:00
* compare longint-cardinal also makes types wider
This commit is contained in:
parent
6c0f8c98f4
commit
4245cedfed
@ -738,39 +738,20 @@ implementation
|
|||||||
{ is there a cardinal? }
|
{ is there a cardinal? }
|
||||||
else if ((torddef(rd).typ=u32bit) or (torddef(ld).typ=u32bit)) then
|
else if ((torddef(rd).typ=u32bit) or (torddef(ld).typ=u32bit)) then
|
||||||
begin
|
begin
|
||||||
if is_signed(ld) and
|
{ and,or,xor work on bit patterns and don't care
|
||||||
{ then rd = u32bit }
|
about the sign }
|
||||||
(nodetype in [addn,subn,muln]) and
|
if nodetype in [andn,orn,xorn] then
|
||||||
{ convert positive constants to u32bit }
|
|
||||||
not(is_constintnode(left) and
|
|
||||||
(tordconstnode(left).value >= 0)) then
|
|
||||||
begin
|
begin
|
||||||
{ perform the operation in 64bit }
|
inserttypeconv_explicit(left,u32bittype);
|
||||||
CGMessage(type_w_mixed_signed_unsigned);
|
inserttypeconv_explicit(right,u32bittype);
|
||||||
inserttypeconv(left,cs64bittype);
|
|
||||||
inserttypeconv(right,cs64bittype);
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ and,or,xor work on bit patterns and don't care
|
if is_signed(ld) and
|
||||||
about the sign }
|
{ then rd = u32bit }
|
||||||
if nodetype in [andn,orn,xorn] then
|
|
||||||
inserttypeconv_explicit(left,u32bittype)
|
|
||||||
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,u32bittype);
|
|
||||||
end;
|
|
||||||
|
|
||||||
if is_signed(rd) and
|
|
||||||
{ then ld = u32bit }
|
|
||||||
(nodetype in [addn,subn,muln]) and
|
|
||||||
{ convert positive constants to u32bit }
|
{ convert positive constants to u32bit }
|
||||||
not(is_constintnode(right) and
|
not(is_constintnode(left) and
|
||||||
(tordconstnode(right).value >= 0)) then
|
(tordconstnode(left).value >= 0)) then
|
||||||
begin
|
begin
|
||||||
{ perform the operation in 64bit }
|
{ perform the operation in 64bit }
|
||||||
CGMessage(type_w_mixed_signed_unsigned);
|
CGMessage(type_w_mixed_signed_unsigned);
|
||||||
@ -779,18 +760,31 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ and,or,xor work on bit patterns and don't care
|
if is_signed(ld) and
|
||||||
about the sign }
|
not(is_constintnode(left) and
|
||||||
if nodetype in [andn,orn,xorn] then
|
(tordconstnode(left).value >= 0)) then
|
||||||
inserttypeconv_explicit(left,u32bittype)
|
CGMessage(type_w_mixed_signed_unsigned2);
|
||||||
|
inserttypeconv(left,u32bittype);
|
||||||
|
|
||||||
|
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,cs64bittype);
|
||||||
|
inserttypeconv(right,cs64bittype);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if is_signed(rd) and
|
if is_signed(rd) and
|
||||||
not(is_constintnode(right) and
|
not(is_constintnode(right) and
|
||||||
(tordconstnode(right).value >= 0)) then
|
(tordconstnode(right).value >= 0)) then
|
||||||
CGMessage(type_w_mixed_signed_unsigned2);
|
CGMessage(type_w_mixed_signed_unsigned2);
|
||||||
inserttypeconv(right,u32bittype);
|
inserttypeconv(right,u32bittype);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -1875,7 +1869,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.98 2003-10-21 18:16:13 peter
|
Revision 1.99 2003-10-28 15:35:18 peter
|
||||||
|
* compare longint-cardinal also makes types wider
|
||||||
|
|
||||||
|
Revision 1.98 2003/10/21 18:16:13 peter
|
||||||
* IncompatibleTypes() added that will include unit names when
|
* IncompatibleTypes() added that will include unit names when
|
||||||
the typenames are the same
|
the typenames are the same
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user