|
@@ -2461,14 +2461,22 @@ implementation
|
|
|
if (left.nodetype=realconstn) and (is_currency(left.resultdef)) and (not(nf_is_currency in left.flags)) and ((trunc(trealconstnode(left).value_real) mod 10000)=0) then
|
|
|
begin
|
|
|
{ trealconstnode expects that value_real and value_currency contain valid values }
|
|
|
- trealconstnode(left).value_currency:=trealconstnode(left).value_currency {$ifdef FPC_CURRENCY_IS_INT64}div{$else}/{$endif} 10000;
|
|
|
+{$ifdef FPC_CURRENCY_IS_INT64}
|
|
|
+ trealconstnode(left).value_currency:=pint64(@(trealconstnode(left).value_currency))^ div 10000;
|
|
|
+{$else}
|
|
|
+ trealconstnode(left).value_currency:=trealconstnode(left).value_currency / 10000;
|
|
|
+{$endif}
|
|
|
trealconstnode(left).value_real:=trealconstnode(left).value_real/10000;
|
|
|
end
|
|
|
{ or if right is an integer constant, we can get rid of its factor 10000 }
|
|
|
else if (right.nodetype=realconstn) and (is_currency(right.resultdef)) and (not(nf_is_currency in right.flags)) and ((trunc(trealconstnode(right).value_real) mod 10000)=0) then
|
|
|
begin
|
|
|
{ trealconstnode expects that value and value_currency contain valid values }
|
|
|
- trealconstnode(right).value_currency:=trealconstnode(right).value_currency {$ifdef FPC_CURRENCY_IS_INT64}div{$else}/{$endif} 10000;
|
|
|
+{$ifdef FPC_CURRENCY_IS_INT64}
|
|
|
+ trealconstnode(right).value_currency:=pint64(@(trealconstnode(right).value_currency))^ div 10000;
|
|
|
+{$else}
|
|
|
+ trealconstnode(right).value_currency:=trealconstnode(right).value_currency / 10000;
|
|
|
+{$endif}
|
|
|
trealconstnode(right).value_real:=trealconstnode(right).value_real/10000;
|
|
|
end
|
|
|
else
|
|
@@ -2488,6 +2496,29 @@ implementation
|
|
|
tordconstnode(right).value:=tordconstnode(right).value div 10000
|
|
|
else
|
|
|
{$endif VER3_0}
|
|
|
+ if (right.nodetype=muln) and is_currency(right.resultdef) and
|
|
|
+ { do not test swapped here as the internal conversions are only create as "var."*"10000" }
|
|
|
+ is_currency(taddnode(right).right.resultdef) and (taddnode(right).right.nodetype=ordconstn) and (tordconstnode(taddnode(right).right).value=10000) and
|
|
|
+ is_currency(taddnode(right).left.resultdef) and (taddnode(right).left.nodetype=typeconvn) then
|
|
|
+ begin
|
|
|
+ hp:=taddnode(right).left.getcopy;
|
|
|
+ include(hp.flags,nf_is_currency);
|
|
|
+ right.free;
|
|
|
+ right:=hp;
|
|
|
+ hp:=nil;
|
|
|
+ end
|
|
|
+ else if (left.nodetype=muln) and is_currency(left.resultdef) and
|
|
|
+ { do not test swapped here as the internal conversions are only create as "var."*"10000" }
|
|
|
+ is_currency(taddnode(left).right.resultdef) and (taddnode(left).right.nodetype=ordconstn) and (tordconstnode(taddnode(left).right).value=10000) and
|
|
|
+ is_currency(taddnode(left).left.resultdef) and (taddnode(left).left.nodetype=typeconvn) then
|
|
|
+ begin
|
|
|
+ hp:=taddnode(left).left.getcopy;
|
|
|
+ include(hp.flags,nf_is_currency);
|
|
|
+ left.free;
|
|
|
+ left:=hp;
|
|
|
+ hp:=nil;
|
|
|
+ end
|
|
|
+ else
|
|
|
begin
|
|
|
hp:=cmoddivnode.create(divn,getcopy,cordconstnode.create(10000,s64currencytype,false));
|
|
|
include(hp.flags,nf_is_currency);
|