|
@@ -95,7 +95,6 @@ implementation
|
|
lt,rt : tnodetype;
|
|
lt,rt : tnodetype;
|
|
rv,lv : tconstexprint;
|
|
rv,lv : tconstexprint;
|
|
rvd,lvd : bestreal;
|
|
rvd,lvd : bestreal;
|
|
- resdef,
|
|
|
|
rd,ld : pdef;
|
|
rd,ld : pdef;
|
|
tempdef : pdef;
|
|
tempdef : pdef;
|
|
concatstrings : boolean;
|
|
concatstrings : boolean;
|
|
@@ -104,6 +103,7 @@ implementation
|
|
resultset : pconstset;
|
|
resultset : pconstset;
|
|
i : longint;
|
|
i : longint;
|
|
b : boolean;
|
|
b : boolean;
|
|
|
|
+ boolres,
|
|
convdone : boolean;
|
|
convdone : boolean;
|
|
s1,s2 : pchar;
|
|
s1,s2 : pchar;
|
|
l1,l2 : longint;
|
|
l1,l2 : longint;
|
|
@@ -159,8 +159,7 @@ implementation
|
|
rt:=realconstn;
|
|
rt:=realconstn;
|
|
end;
|
|
end;
|
|
|
|
|
|
- { both are int constants, also allow operations on two equal enums
|
|
|
|
- in fpc mode (Needed for conversion of C code) }
|
|
|
|
|
|
+ { both are int constants }
|
|
if ((lt=ordconstn) and (rt=ordconstn)) and
|
|
if ((lt=ordconstn) and (rt=ordconstn)) and
|
|
((is_constintnode(left) and is_constintnode(right)) or
|
|
((is_constintnode(left) and is_constintnode(right)) or
|
|
(is_constboolnode(left) and is_constboolnode(right) and
|
|
(is_constboolnode(left) and is_constboolnode(right) and
|
|
@@ -169,21 +168,25 @@ implementation
|
|
{ xor, and, or are handled different from arithmetic }
|
|
{ xor, and, or are handled different from arithmetic }
|
|
{ operations regarding the result type }
|
|
{ operations regarding the result type }
|
|
{ return a boolean for boolean operations (and,xor,or) }
|
|
{ return a boolean for boolean operations (and,xor,or) }
|
|
- if is_constboolnode(left) then
|
|
|
|
- resdef:=booldef
|
|
|
|
- else if is_64bitint(rd) or is_64bitint(ld) then
|
|
|
|
- resdef:=cs64bitdef
|
|
|
|
- else
|
|
|
|
- resdef:=s32bitdef;
|
|
|
|
|
|
+ boolres:=is_constboolnode(left);
|
|
lv:=tordconstnode(left).value;
|
|
lv:=tordconstnode(left).value;
|
|
rv:=tordconstnode(right).value;
|
|
rv:=tordconstnode(right).value;
|
|
case nodetype of
|
|
case nodetype of
|
|
addn : t:=genintconstnode(lv+rv);
|
|
addn : t:=genintconstnode(lv+rv);
|
|
subn : t:=genintconstnode(lv-rv);
|
|
subn : t:=genintconstnode(lv-rv);
|
|
muln : t:=genintconstnode(lv*rv);
|
|
muln : t:=genintconstnode(lv*rv);
|
|
- xorn : t:=genordinalconstnode(lv xor rv,resdef);
|
|
|
|
- orn: t:=genordinalconstnode(lv or rv,resdef);
|
|
|
|
- andn: t:=genordinalconstnode(lv and rv,resdef);
|
|
|
|
|
|
+ xorn : if boolres then
|
|
|
|
+ t:=genordinalconstnode(lv xor rv,booldef)
|
|
|
|
+ else
|
|
|
|
+ t:=genintconstnode(lv xor rv);
|
|
|
|
+ orn : if boolres then
|
|
|
|
+ t:=genordinalconstnode(lv or rv,booldef)
|
|
|
|
+ else
|
|
|
|
+ t:=genintconstnode(lv or rv);
|
|
|
|
+ andn : if boolres then
|
|
|
|
+ t:=genordinalconstnode(lv and rv,booldef)
|
|
|
|
+ else
|
|
|
|
+ t:=genintconstnode(lv and rv);
|
|
ltn : t:=genordinalconstnode(ord(lv<rv),booldef);
|
|
ltn : t:=genordinalconstnode(ord(lv<rv),booldef);
|
|
lten : t:=genordinalconstnode(ord(lv<=rv),booldef);
|
|
lten : t:=genordinalconstnode(ord(lv<=rv),booldef);
|
|
gtn : t:=genordinalconstnode(ord(lv>rv),booldef);
|
|
gtn : t:=genordinalconstnode(ord(lv>rv),booldef);
|
|
@@ -1209,7 +1212,12 @@ begin
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.20 2000-12-31 11:14:10 jonas
|
|
|
|
|
|
+ Revision 1.21 2001-01-14 22:13:13 peter
|
|
|
|
+ * constant calculation fixed. The type of the new constant is now
|
|
|
|
+ defined after the calculation is done. This should remove a lot
|
|
|
|
+ of wrong warnings (and errors with -Cr).
|
|
|
|
+
|
|
|
|
+ Revision 1.20 2000/12/31 11:14:10 jonas
|
|
+ implemented/fixed docompare() mathods for all nodes (not tested)
|
|
+ implemented/fixed docompare() mathods for all nodes (not tested)
|
|
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
|
|
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
|
|
and constant strings/chars together
|
|
and constant strings/chars together
|