mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 10:20:21 +02:00
* do an unsigned division if one operand is unsigned an the other
one a constant in its range, resolves #38180 git-svn-id: trunk@47797 -
This commit is contained in:
parent
9858d9c5e6
commit
9af9f140a5
@ -283,19 +283,32 @@ implementation
|
||||
(not is_signed(ld) and
|
||||
(rd.size >= ld.size))) then
|
||||
begin
|
||||
inserttypeconv(left,right.resultdef);
|
||||
ld:=torddef(left.resultdef);
|
||||
end;
|
||||
if (ld.ordtype in [u8bit,u16bit,u32bit,u64bit]) and
|
||||
if rd.size<uinttype.size then
|
||||
begin
|
||||
inserttypeconv(left,uinttype);
|
||||
inserttypeconv(right,uinttype);
|
||||
end
|
||||
else
|
||||
inserttypeconv(left,rd);
|
||||
resultdef:=right.resultdef;
|
||||
end
|
||||
else if (ld.ordtype in [u8bit,u16bit,u32bit,u64bit]) and
|
||||
((is_constintnode(right) and
|
||||
(tordconstnode(right).value >= 0) and
|
||||
(tordconstnode(right).value <= get_max_value(ld))) or
|
||||
(not is_signed(rd) and
|
||||
(ld.size >= rd.size))) then
|
||||
begin
|
||||
inserttypeconv(right,left.resultdef);
|
||||
rd:=torddef(right.resultdef);
|
||||
end;
|
||||
begin
|
||||
if ld.size<uinttype.size then
|
||||
begin
|
||||
inserttypeconv(left,uinttype);
|
||||
inserttypeconv(right,uinttype);
|
||||
end
|
||||
else
|
||||
inserttypeconv(right,ld);
|
||||
resultdef:=left.resultdef;
|
||||
end
|
||||
else
|
||||
|
||||
{ when there is one currency value, everything is done
|
||||
using currency }
|
||||
|
@ -386,8 +386,6 @@ interface
|
||||
{ put numerator in register }
|
||||
cgsize:=def_cgsize(resultdef);
|
||||
opsize:=TCGSize2OpSize[cgsize];
|
||||
if not (cgsize in [OS_32,OS_S32,OS_64,OS_S64]) then
|
||||
InternalError(2013102702);
|
||||
rega:=newreg(R_INTREGISTER,RS_EAX,cgsize2subreg(R_INTREGISTER,cgsize));
|
||||
regd:=newreg(R_INTREGISTER,RS_EDX,cgsize2subreg(R_INTREGISTER,cgsize));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user