|
@@ -439,7 +439,7 @@ implementation
|
|
end
|
|
end
|
|
end;
|
|
end;
|
|
|
|
|
|
- { Add,Sub,Mul with constant 0 or 1? }
|
|
|
|
|
|
+ { Add,Sub,Mul with constant 0, 1 or -1? }
|
|
if is_constintnode(right) and is_integer(left.resultdef) then
|
|
if is_constintnode(right) and is_integer(left.resultdef) then
|
|
begin
|
|
begin
|
|
if tordconstnode(right).value = 0 then
|
|
if tordconstnode(right).value = 0 then
|
|
@@ -457,6 +457,13 @@ implementation
|
|
muln:
|
|
muln:
|
|
result := left.getcopy;
|
|
result := left.getcopy;
|
|
end;
|
|
end;
|
|
|
|
+ end
|
|
|
|
+ else if tordconstnode(right).value = -1 then
|
|
|
|
+ begin
|
|
|
|
+ case nodetype of
|
|
|
|
+ muln:
|
|
|
|
+ result := cunaryminusnode.create(left.getcopy);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
if assigned(result) then
|
|
if assigned(result) then
|
|
exit;
|
|
exit;
|
|
@@ -480,6 +487,13 @@ implementation
|
|
muln:
|
|
muln:
|
|
result := right.getcopy;
|
|
result := right.getcopy;
|
|
end;
|
|
end;
|
|
|
|
+ end
|
|
|
|
+ else if tordconstnode(left).value = -1 then
|
|
|
|
+ begin
|
|
|
|
+ case nodetype of
|
|
|
|
+ muln:
|
|
|
|
+ result := cunaryminusnode.create(right.getcopy);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
if assigned(result) then
|
|
if assigned(result) then
|
|
exit;
|
|
exit;
|