Browse Source

* fixed conversion from int64/qword to double errors

Jonas Maebe 23 years ago
parent
commit
a28ee81ed6
2 changed files with 20 additions and 3 deletions
  1. 9 1
      rtl/inc/compproc.inc
  2. 11 2
      rtl/powerpc/math.inc

+ 9 - 1
rtl/inc/compproc.inc

@@ -252,11 +252,19 @@ Procedure fpc_rewrite_typed(var f : TypedFile;Size : Longint); compilerproc;
 Procedure fpc_typed_write(TypeSize : Longint;var f : TypedFile;const Buf); compilerproc;
 Procedure fpc_typed_read(TypeSize : Longint;var f : TypedFile;var Buf); compilerproc;
 
+{$ifdef POWERPC}
+function fpc_int64_to_double(i: int64): double; compilerproc;
+function fpc_qword_to_double(q: qword): double; compilerproc;
+{$endif POWERPC}
+
 {$endif hascompilerproc}
 
 {
   $Log$
-  Revision 1.17  2002-07-28 20:43:47  florian
+  Revision 1.18  2002-07-31 16:58:12  jonas
+    * fixed conversion from int64/qword to double errors
+
+  Revision 1.17  2002/07/28 20:43:47  florian
     * several fixes for linux/powerpc
     * several fixes to MT
 

+ 11 - 2
rtl/powerpc/math.inc

@@ -76,6 +76,7 @@
         runerror(207);
       end;
 
+
     {$define FPC_SYSTEM_HAS_TRUNC}
     {$warning FIX ME}
     function trunc(d : extended) : int64;assembler;[internconst:in_const_trunc];
@@ -205,6 +206,11 @@
                          Int to real helpers
  ****************************************************************************}
 
+const
+  longint_to_real_helper: int64 = 0x4330000080000000;
+  cardinal_to_real_helper: int64 = 0x430000000000000;
+  int_to_real_factor: double = double(high(cardinal))+1.0;
+
 function fpc_int64_to_double(i: int64): double; compilerproc;
 assembler;
 { input: high(i) in r3, low(i) in r4 }
@@ -236,7 +242,7 @@ asm
 end ['r0','r3','r4','f0','f1','f2','f3'];
 
 
-function fpc_qword_to_real(q: qword): double; compilerproc;
+function fpc_qword_to_double(q: qword): double; compilerproc;
 assembler;
 { input: high(q) in r3, low(q) in r4 }
 { output: double(q) in f0            }
@@ -267,7 +273,10 @@ end ['r0','r3','f0','f1','f2','f3'];
 
 {
   $Log$
-  Revision 1.6  2002-07-29 21:28:17  florian
+  Revision 1.7  2002-07-31 16:58:12  jonas
+    * fixed conversion from int64/qword to double errors
+
+  Revision 1.6  2002/07/29 21:28:17  florian
     * several fixes to get further with linux/ppc system unit compilation
 
   Revision 1.5  2002/07/28 21:39:29  florian