Browse Source

* made the softfpu unit embedable in the system unit
* several fixes to get the softfpu working
* resolved conflicts between genmath and softfpu

git-svn-id: trunk@4935 -

florian 19 years ago
parent
commit
5f3a3bc051
2 changed files with 206 additions and 181 deletions
  1. 39 21
      rtl/inc/genmath.inc
  2. 167 160
      rtl/inc/softfpu.pp

+ 39 - 21
rtl/inc/genmath.inc

@@ -38,7 +38,29 @@
 {$goto on}
 {$goto on}
 
 
 type
 type
-    TabCoef = array[0..6] of Real;
+  TabCoef = array[0..6] of Real;
+{ also necessary for Int() on systems with 64bit floats (JM) }
+{$ifndef FPC_SYSTEM_HAS_float64}
+{$ifdef ENDIAN_LITTLE}
+  float64 = packed record
+    low: longint;
+    high: longint;
+  end;
+{$else}
+  float64 = packed record
+    high: longint;
+    low: longint;
+  end;
+{$endif}
+{$endif FPC_SYSTEM_HAS_float64}
+
+{$ifndef FPC_SYSTEM_HAS_TRUNC}
+{$ifndef FPC_SYSTEM_HAS_float32}
+  float32 = longint;
+{$endif FPC_SYSTEM_HAS_float32}
+{$ifndef FPC_SYSTEM_HAS_flag}
+  flag = byte;
+{$endif FPC_SYSTEM_HAS_float32}
 
 
 
 
 const
 const
@@ -76,54 +98,44 @@ const sincof : TabCoef = (
                 4.16666666666665929218E-2, 0);
                 4.16666666666665929218E-2, 0);
 
 
 
 
-
-{ also necessary for Int() on systems with 64bit floats (JM) }
-type
-{$ifdef ENDIAN_LITTLE}
-  float64 = packed record
-    low: longint;
-    high: longint;
-  end;
-{$else}
-  float64 = packed record
-    high: longint;
-    low: longint;
-  end;
-{$endif}
-
-{$ifndef FPC_SYSTEM_HAS_TRUNC}
-type
-  float32 = longint;
-  flag = byte;
-
+{$ifndef FPC_SYSTEM_HAS_extractFloat64Frac0}
   Function extractFloat64Frac0(const a: float64): longint;
   Function extractFloat64Frac0(const a: float64): longint;
     Begin
     Begin
       extractFloat64Frac0 := a.high and $000FFFFF;
       extractFloat64Frac0 := a.high and $000FFFFF;
     End;
     End;
+{$endif FPC_SYSTEM_HAS_extractFloat64Frac0}
 
 
 
 
+{$ifndef FPC_SYSTEM_HAS_extractFloat64Frac1}
   Function extractFloat64Frac1(const a: float64): longint;
   Function extractFloat64Frac1(const a: float64): longint;
     Begin
     Begin
       extractFloat64Frac1 := a.low;
       extractFloat64Frac1 := a.low;
     End;
     End;
+{$endif FPC_SYSTEM_HAS_extractFloat64Frac1}
 
 
 
 
+{$ifndef FPC_SYSTEM_HAS_extractFloat64Exp}
   Function extractFloat64Exp(const a: float64): smallint;
   Function extractFloat64Exp(const a: float64): smallint;
     Begin
     Begin
        extractFloat64Exp:= ( a.high shr 20 ) AND $7FF;
        extractFloat64Exp:= ( a.high shr 20 ) AND $7FF;
     End;
     End;
+{$endif FPC_SYSTEM_HAS_extractFloat64Exp}
 
 
 
 
+{$ifndef FPC_SYSTEM_HAS_extractFloat64Frac}
   Function extractFloat64Frac(const a: float64): int64;
   Function extractFloat64Frac(const a: float64): int64;
     Begin
     Begin
       extractFloat64Frac:=int64(a) and $000FFFFFFFFFFFFF;
       extractFloat64Frac:=int64(a) and $000FFFFFFFFFFFFF;
     End;
     End;
+{$endif FPC_SYSTEM_HAS_extractFloat64Frac}
 
 
 
 
+{$ifndef FPC_SYSTEM_HAS_extractFloat64Sign}
   Function extractFloat64Sign(const a: float64) : flag;
   Function extractFloat64Sign(const a: float64) : flag;
     Begin
     Begin
        extractFloat64Sign := a.high shr 31;
        extractFloat64Sign := a.high shr 31;
     End;
     End;
+{$endif FPC_SYSTEM_HAS_extractFloat64Sign}
 
 
 
 
   Procedure shortShift64Left(a0:longint; a1:longint; count:smallint; VAR z0Ptr:longint; VAR z1Ptr:longint );
   Procedure shortShift64Left(a0:longint; a1:longint; count:smallint; VAR z0Ptr:longint; VAR z1Ptr:longint );
@@ -216,22 +228,28 @@ type
        result:=z;
        result:=z;
      end;
      end;
 
 
+{$ifndef FPC_SYSTEM_HAS_ExtractFloat32Frac}
   Function ExtractFloat32Frac(a : Float32) : longint;
   Function ExtractFloat32Frac(a : Float32) : longint;
     Begin
     Begin
        ExtractFloat32Frac := A AND $007FFFFF;
        ExtractFloat32Frac := A AND $007FFFFF;
     End;
     End;
+{$endif FPC_SYSTEM_HAS_ExtractFloat32Frac}
 
 
 
 
+{$ifndef FPC_SYSTEM_HAS_extractFloat32Exp}
   Function extractFloat32Exp( a: float32 ): smallint;
   Function extractFloat32Exp( a: float32 ): smallint;
     Begin
     Begin
       extractFloat32Exp := (a shr 23) AND $FF;
       extractFloat32Exp := (a shr 23) AND $FF;
     End;
     End;
+{$endif FPC_SYSTEM_HAS_extractFloat32Exp}
 
 
 
 
+{$ifndef FPC_SYSTEM_HAS_extractFloat32Sign}
   Function extractFloat32Sign( a: float32 ): Flag;
   Function extractFloat32Sign( a: float32 ): Flag;
     Begin
     Begin
       extractFloat32Sign := a shr 31;
       extractFloat32Sign := a shr 31;
     End;
     End;
+{$endif FPC_SYSTEM_HAS_extractFloat32Sign}
 
 
 
 
   Function float32_to_int32_round_to_zero( a: Float32 ): longint;
   Function float32_to_int32_round_to_zero( a: Float32 ): longint;

File diff suppressed because it is too large
+ 167 - 160
rtl/inc/softfpu.pp


Some files were not shown because too many files changed in this diff