mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 13:49:39 +02:00
* improved the readability of the code of taddnode.try_make_mul32to64() even
more by factoring out some of the node tests to nested functions git-svn-id: trunk@26414 -
This commit is contained in:
parent
ac177a445e
commit
372e9dfdf1
@ -2526,21 +2526,30 @@ implementation
|
|||||||
((v >= qword(low(cardinal))) and (v <= qword(high(cardinal))))
|
((v >= qword(low(cardinal))) and (v <= qword(high(cardinal))))
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function is_32bitordconst(n: tnode): boolean;
|
||||||
|
begin
|
||||||
|
result := (n.nodetype = ordconstn) and
|
||||||
|
canbe32bitint(tordconstnode(n).value);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function is_32to64typeconv(n: tnode): boolean;
|
||||||
|
begin
|
||||||
|
result := (n.nodetype = typeconvn) and
|
||||||
|
is_integer(ttypeconvnode(n).left.resultdef) and
|
||||||
|
not is_64bit(ttypeconvnode(n).left.resultdef);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
temp: tnode;
|
temp: tnode;
|
||||||
begin
|
begin
|
||||||
result := false;
|
result := false;
|
||||||
if ((left.nodetype = typeconvn) and
|
if is_32to64typeconv(left) and
|
||||||
is_integer(ttypeconvnode(left).left.resultdef) and
|
(is_32bitordconst(right) or
|
||||||
not is_64bit(ttypeconvnode(left).left.resultdef) and
|
is_32to64typeconv(right) and
|
||||||
(((right.nodetype = ordconstn) and canbe32bitint(tordconstnode(right).value)) or
|
|
||||||
((right.nodetype = typeconvn) and
|
|
||||||
is_integer(ttypeconvnode(right).left.resultdef) and
|
|
||||||
not is_64bit(ttypeconvnode(right).left.resultdef)) and
|
|
||||||
((is_signed(ttypeconvnode(left).left.resultdef) =
|
((is_signed(ttypeconvnode(left).left.resultdef) =
|
||||||
is_signed(ttypeconvnode(right).left.resultdef)) or
|
is_signed(ttypeconvnode(right).left.resultdef)) or
|
||||||
(is_signed(ttypeconvnode(left).left.resultdef) and
|
(is_signed(ttypeconvnode(left).left.resultdef) and
|
||||||
(torddef(ttypeconvnode(right).left.resultdef).ordtype in [u8bit,u16bit]))))) then
|
(torddef(ttypeconvnode(right).left.resultdef).ordtype in [u8bit,u16bit])))) then
|
||||||
begin
|
begin
|
||||||
temp := ttypeconvnode(left).left;
|
temp := ttypeconvnode(left).left;
|
||||||
ttypeconvnode(left).left := nil;
|
ttypeconvnode(left).left := nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user