Browse Source

m68k: replaced fpc_longword_to_double function with a working and branchless version. fixes tcnvint4 test among others with FPU enabled.

git-svn-id: trunk@36503 -
Károly Balogh 8 years ago
parent
commit
a635f435b9
1 changed files with 2 additions and 14 deletions
  1. 2 14
      rtl/m68k/math.inc

+ 2 - 14
rtl/m68k/math.inc

@@ -14,20 +14,8 @@
 
 
 {$ifdef FPC_INCLUDE_SOFTWARE_LONGWORD_TO_DOUBLE}
 {$ifdef FPC_INCLUDE_SOFTWARE_LONGWORD_TO_DOUBLE}
 function fpc_longword_to_double(i: longword): double; compilerproc;
 function fpc_longword_to_double(i: longword): double; compilerproc;
-var
-  l : longint;
 begin
 begin
-{$ifopt R+}
-{$define HAS_OPTR}
-{$endif}
-{$r-}
-  l:=longint(i);
-{$ifdef HAS_OPTR}
-{$r+}
-{$endif}
-  if l>=0 then
-    fpc_longword_to_double:=double(l)
-  else
-    fpc_longword_to_double:=-double(abs(l));
+  qword(result):=(qword(1075) shl 52) + i;
+  result:=result - (qword(1) shl 52);
 end;
 end;
 {$endif FPC_INCLUDE_SOFTWARE_LONGWORD_TO_DOUBLE}
 {$endif FPC_INCLUDE_SOFTWARE_LONGWORD_TO_DOUBLE}