Browse Source

* fixed some arm related real stuff

florian 21 years ago
parent
commit
5fe2004441
2 changed files with 32 additions and 12 deletions
  1. 19 10
      rtl/inc/genmath.inc
  2. 13 2
      rtl/inc/real2str.inc

+ 19 - 10
rtl/inc/genmath.inc

@@ -235,12 +235,12 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
      if sizeof(D)=8 then
      if sizeof(D)=8 then
        begin
        begin
          move(d,f64,sizeof(f64));
          move(d,f64,sizeof(f64));
-{$ifdef arm}
+{$ifdef cpuarm}
          { the arm fpu has a strange opinion how a double has to be stored }
          { the arm fpu has a strange opinion how a double has to be stored }
          l:=f64.low;
          l:=f64.low;
          f64.low:=f64.high;
          f64.low:=f64.high;
          f64.high:=l;
          f64.high:=l;
-{$endif arm}
+{$endif cpuarm}
          trunc:=float64_to_int32_round_to_zero(f64);
          trunc:=float64_to_int32_round_to_zero(f64);
        end
        end
      else
      else
@@ -267,13 +267,13 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
         sx: longint;
         sx: longint;
         f64 : float64;
         f64 : float64;
       begin
       begin
-         f64:=float64(d);
-{$ifdef arm}
-         { the arm fpu has a strange opinion how a double has to be stored }
-         i0:=f64.low;
-         f64.low:=f64.high;
-         f64.high:=i0;
-{$endif arm}
+        f64:=float64(d);
+{$ifdef cpuarm}
+        { the arm fpu has a strange opinion how a double has to be stored }
+        i0:=f64.low;
+        f64.low:=f64.high;
+        f64.high:=i0;
+{$endif cpuarm}
         i0 := f64.high;
         i0 := f64.high;
         i1 := cardinal(f64.low);
         i1 := cardinal(f64.low);
         sx := i0 and $80000000;
         sx := i0 and $80000000;
@@ -303,6 +303,12 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
             f64.high := i0;
             f64.high := i0;
             f64.low := longint(i1 and not(cardinal($ffffffff) shr (j0 - 20)));
             f64.low := longint(i1 and not(cardinal($ffffffff) shr (j0 - 20)));
           end;
           end;
+{$ifdef cpuarm}
+        { the arm fpu has a strange opinion how a double has to be stored }
+        i0:=f64.low;
+        f64.low:=f64.high;
+        f64.high:=i0;
+{$endif cpuarm}
         result:=double(f64);
         result:=double(f64);
       end;
       end;
 
 
@@ -1180,7 +1186,10 @@ function fpc_int64_to_double(i : int64): double; compilerproc;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2004-03-11 22:39:53  florian
+  Revision 1.23  2004-03-13 18:33:52  florian
+    * fixed some arm related real stuff
+
+  Revision 1.22  2004/03/11 22:39:53  florian
     * arm startup code fixed
     * arm startup code fixed
     * made some generic math code more readable
     * made some generic math code more readable
 
 

+ 13 - 2
rtl/inc/real2str.inc

@@ -283,11 +283,19 @@ begin
   {$error sign/NaN/Inf not yet supported for big endian CPU's in str_real}
   {$error sign/NaN/Inf not yet supported for big endian CPU's in str_real}
 {$else SUPPORT_EXTENDED}
 {$else SUPPORT_EXTENDED}
 {$ifdef SUPPORT_DOUBLE}
 {$ifdef SUPPORT_DOUBLE}
+{$ifdef CPUARM}
+  { double, format (MSB): 1 Sign bit, 11 bit exponent, 52 bit mantissa }
+  sign := ((TSplitDouble(d).cards[1] shr 20) and $800) <> 0;
+  expMaximal := ((TSplitDouble(d).cards[1] shr 20) and $7ff) = 2047;
+  fraczero := (TSplitDouble(d).cards[1] and $fffff = 0) and
+              (TSplitDouble(d).cards[0] = 0);
+{$else CPUARM}
+  { double, format (MSB): 1 Sign bit, 11 bit exponent, 52 bit mantissa }
   sign := ((TSplitDouble(d).cards[0] shr 20) and $800) <> 0;
   sign := ((TSplitDouble(d).cards[0] shr 20) and $800) <> 0;
   expMaximal := ((TSplitDouble(d).cards[0] shr 20) and $7ff) = 2047;
   expMaximal := ((TSplitDouble(d).cards[0] shr 20) and $7ff) = 2047;
   fraczero:= (TSplitDouble(d).cards[0] and $fffff = 0) and
   fraczero:= (TSplitDouble(d).cards[0] and $fffff = 0) and
               (TSplitDouble(d).cards[1] = 0);
               (TSplitDouble(d).cards[1] = 0);
-  { double, format (MSB): 1 Sign bit, 11 bit exponent, 52 bit mantissa }
+{$endif CPUARM}
 {$else SUPPORT_DOUBLE}
 {$else SUPPORT_DOUBLE}
 {$ifdef SUPPORT_SINGLE}
 {$ifdef SUPPORT_SINGLE}
   { single, format (MSB): 1 Sign bit, 8 bit exponent, 23 bit mantissa }
   { single, format (MSB): 1 Sign bit, 8 bit exponent, 23 bit mantissa }
@@ -452,7 +460,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2003-12-29 19:19:21  jonas
+  Revision 1.14  2004-03-13 18:33:52  florian
+    * fixed some arm related real stuff
+
+  Revision 1.13  2003/12/29 19:19:21  jonas
     * fixed NaN/Inf detection for single/double
     * fixed NaN/Inf detection for single/double
 
 
   Revision 1.12  2003/12/08 17:45:00  peter
   Revision 1.12  2003/12/08 17:45:00  peter