<p style="padding:0 0 0 0; margin:0 0 0 0;">Hi,</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">I have</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">unit1.pas:36 i:=Int64(c);</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">000000000046EEE0 488b45e8 mov -0x18(%rbp),%rax</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">000000000046EEE4 488945e0 mov %rax,-0x20(%rbp)</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">unit1.pas:38 writeln(i);</p>
<div>at Level0 and</div>
<div>
<div>unit1.pas:36 i:=Int64(c);</div>
<div>000000000046EECD 4c8b2424 mov (%rsp),%r12</div>
<div>unit1.pas:38 writeln(i);</div>
</div>
<div>at Level3.</div>
<div>I just noticed that you wrote you are expecting 1000. You should expect 10000 since currency has four decimals.</div>
<div>V. </div>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">______________________________________________________________<br />
> Od: LacaK <lacak@zoznam.sk><br />
> Komu: fpc-pascal@lists.freepascal.org<br />
> Datum: 18.05.2018 07:54<br />
> Předmět: Re: [fpc-pascal] Currency and Int64 casting<br />
></p>
<br />
<blockquote cite="mid:20180517172024.7601650B@atlas.cz">
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">Linux 64-bit Lazarus 1.9.0 r57948M FPC 3.1.1 x86_64-linux-qt gives</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> 1.000000000000000000E+00 10000</p>
</blockquote>
What is dissassembly for:<br />
i:=Int64(c);?<br />
<br />
I have for Win32:<br />
test_curr_int64.lpr:19 i1 := Int64(c);<br />
0040158D a100c04200 mov 0x42c000,%eax<br />
00401592 a310c04200 mov %eax,0x42c010<br />
00401597 a104c04200 mov 0x42c004,%eax<br />
0040159C a314c04200 mov %eax,0x42c014<br />
<br />
and for Win64:<br />
test_curr_int64.lpr:19 i1 := Int64(c);<br />
00000001000015BD 488b0d3caa0300 mov 0x3aa3c(%rip),%rcx # 0x10003c000<br />
00000001000015C4 48b84b598638d6c56d34 movabs $0x346dc5d63886594b,%rax<br />
00000001000015CE 48f7e9 imul %rcx<br />
00000001000015D1 48c1fa0b sar $0xb,%rdx<br />
00000001000015D5 48c1e93f shr $0x3f,%rcx<br />
00000001000015D9 4801ca add %rcx,%rdx<br />
00000001000015DC 4889152daa0300 mov %rdx,0x3aa2d(%rip) # 0x10003c010<br />
<br />
<br />
L.<br />
<blockquote cite="mid:20180517172024.7601650B@atlas.cz">
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">______________________________________________________________<br />
> Od: LacaK <a href="mailto:lacak@zoznam.sk"><lacak@zoznam.sk></a><br />
> Komu: FPC-Pascal users discussions <a href="mailto:fpc-pascal@lists.freepascal.org"><fpc-pascal@lists.freepascal.org></a><br />
> Datum: 17.05.2018 13:33<br />
> Předmět: [fpc-pascal] Currency and Int64 casting<br />
></p>
Hi,<br />
<br />
consider following program:<br />
<br />
var<br />
c: currency;<br />
<br />
begin<br />
c := 1;<br />
writeln(c,' ',Int64(c));<br />
readln;<br />
end.<br />
<br />
FPC 3.0.4<br />
On Win32/x86 I get: 1, 1000 (what I am expecting)<br />
On Win64/x86_64 I get: 1, 1<br />
<br />
Is is as expected ?<br />
<br />
Is there safe way for both platforms how to get 1000 (beside that I can <br />
use: i: int64 absolute c;)<br />
<br />
Thanks<br />
<br />
-Laco.<br />
<br />
_______________________________________________<br />
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br />
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a> <br />
<fieldset class="mimeAttachmentHeader"></fieldset><br />
<pre>_______________________________________________
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></pre>
</blockquote>
<br />
<br />
<br />
----------<br />
<br />
_______________________________________________<br />
fpc-pascal maillist - fpc-pascal@lists.freepascal.org<br />
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>