mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 11:09:23 +02:00
* More efficient if-statement construction in tmoddivnode.simplify
This commit is contained in:
parent
40072fb762
commit
0943458713
@ -178,32 +178,33 @@ implementation
|
|||||||
Result:=ctypeconvnode.create_internal(Result,resultdef);
|
Result:=ctypeconvnode.create_internal(Result,resultdef);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
if is_constintnode(right) and is_constintnode(left) then
|
|
||||||
begin
|
|
||||||
rv:=tordconstnode(right).value;
|
|
||||||
lv:=tordconstnode(left).value;
|
|
||||||
|
|
||||||
case nodetype of
|
if is_constintnode(left) then
|
||||||
modn:
|
begin
|
||||||
if nf_isomod in flags then
|
rv:=tordconstnode(right).value;
|
||||||
begin
|
lv:=tordconstnode(left).value;
|
||||||
if lv>=0 then
|
|
||||||
result:=create_simplified_ord_const(lv mod rv,resultdef,forinline,false)
|
case nodetype of
|
||||||
|
modn:
|
||||||
|
if nf_isomod in flags then
|
||||||
|
begin
|
||||||
|
if lv>=0 then
|
||||||
|
result:=create_simplified_ord_const(lv mod rv,resultdef,forinline,false)
|
||||||
|
else
|
||||||
|
if ((-lv) mod rv)=0 then
|
||||||
|
result:=create_simplified_ord_const((-lv) mod rv,resultdef,forinline,false)
|
||||||
|
else
|
||||||
|
result:=create_simplified_ord_const(rv-((-lv) mod rv),resultdef,forinline,false);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if ((-lv) mod rv)=0 then
|
result:=create_simplified_ord_const(lv mod rv,resultdef,forinline,false);
|
||||||
result:=create_simplified_ord_const((-lv) mod rv,resultdef,forinline,false)
|
divn:
|
||||||
else
|
result:=create_simplified_ord_const(lv div rv,resultdef,forinline,cs_check_overflow in localswitches);
|
||||||
result:=create_simplified_ord_const(rv-((-lv) mod rv),resultdef,forinline,false);
|
else
|
||||||
end
|
internalerror(2019050519);
|
||||||
else
|
end;
|
||||||
result:=create_simplified_ord_const(lv mod rv,resultdef,forinline,false);
|
end;
|
||||||
divn:
|
end;
|
||||||
result:=create_simplified_ord_const(lv div rv,resultdef,forinline,cs_check_overflow in localswitches);
|
|
||||||
else
|
|
||||||
internalerror(2019050519);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user