mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 22:06:08 +02:00
+ support for currency typed constants if currency=int64. Warning: does
not work properly for extreme values if bestreal <= double
This commit is contained in:
parent
7de6463c43
commit
980efd582d
@ -78,6 +78,7 @@ implementation
|
|||||||
srsym : tsym;
|
srsym : tsym;
|
||||||
symt : tsymtable;
|
symt : tsymtable;
|
||||||
value : bestreal;
|
value : bestreal;
|
||||||
|
intvalue : tconstexprint;
|
||||||
strval : pchar;
|
strval : pchar;
|
||||||
pw : pcompilerwidestring;
|
pw : pcompilerwidestring;
|
||||||
error : boolean;
|
error : boolean;
|
||||||
@ -181,23 +182,33 @@ implementation
|
|||||||
Message(cg_e_illegal_expression);
|
Message(cg_e_illegal_expression);
|
||||||
end;
|
end;
|
||||||
s64bit,
|
s64bit,
|
||||||
u64bit:
|
u64bit,
|
||||||
|
scurrency:
|
||||||
begin
|
begin
|
||||||
if is_constintnode(p) then
|
if is_constintnode(p) then
|
||||||
|
intvalue := tordconstnode(p).value
|
||||||
|
{$ifndef VER1_0}
|
||||||
|
else if is_constrealnode(p) and
|
||||||
|
(torddef(t.def).typ = scurrency) and
|
||||||
|
(trealconstnode(p).value_real*10000 >= low(int64)) and
|
||||||
|
(trealconstnode(p).value_real*10000 <= high(int64)) then
|
||||||
|
intvalue := round(trealconstnode(p).value_real*10000)
|
||||||
|
{$endif ndef VER1_0}
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
|
intvalue := 0;
|
||||||
|
Message(cg_e_illegal_expression);
|
||||||
|
end;
|
||||||
if target_info.endian = endian_little then
|
if target_info.endian = endian_little then
|
||||||
begin
|
begin
|
||||||
curconstSegment.concat(Tai_const.Create_32bit(Cardinal(tordconstnode(p).value and $ffffffff)));
|
curconstSegment.concat(Tai_const.Create_32bit(Cardinal(intvalue and $ffffffff)));
|
||||||
curconstSegment.concat(Tai_const.Create_32bit(Cardinal(tordconstnode(p).value shr 32)));
|
curconstSegment.concat(Tai_const.Create_32bit(Cardinal(intvalue shr 32)));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
curconstSegment.concat(Tai_const.Create_32bit(Cardinal(tordconstnode(p).value shr 32)));
|
curconstSegment.concat(Tai_const.Create_32bit(Cardinal(intvalue shr 32)));
|
||||||
curconstSegment.concat(Tai_const.Create_32bit(Cardinal(tordconstnode(p).value and $ffffffff)));
|
curconstSegment.concat(Tai_const.Create_32bit(Cardinal(intvalue and $ffffffff)));
|
||||||
end;
|
end;
|
||||||
end
|
|
||||||
else
|
|
||||||
Message(cg_e_illegal_expression);
|
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
internalerror(3799);
|
internalerror(3799);
|
||||||
@ -1002,7 +1013,11 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.76 2003-12-08 22:34:24 peter
|
Revision 1.77 2003-12-29 12:48:39 jonas
|
||||||
|
+ support for currency typed constants if currency=int64. Warning: does
|
||||||
|
not work properly for extreme values if bestreal <= double
|
||||||
|
|
||||||
|
Revision 1.76 2003/12/08 22:34:24 peter
|
||||||
* tai_const.create_32bit changed to cardinal
|
* tai_const.create_32bit changed to cardinal
|
||||||
|
|
||||||
Revision 1.75 2003/11/22 00:32:35 jonas
|
Revision 1.75 2003/11/22 00:32:35 jonas
|
||||||
|
Loading…
Reference in New Issue
Block a user