From 5fe2004441c58d31070681d1a9c0a30f0fe839c6 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 13 Mar 2004 18:33:52 +0000 Subject: [PATCH] * fixed some arm related real stuff --- rtl/inc/genmath.inc | 29 +++++++++++++++++++---------- rtl/inc/real2str.inc | 15 +++++++++++++-- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/rtl/inc/genmath.inc b/rtl/inc/genmath.inc index 069475bcc0..398fa52ff5 100644 --- a/rtl/inc/genmath.inc +++ b/rtl/inc/genmath.inc @@ -235,12 +235,12 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint; if sizeof(D)=8 then begin move(d,f64,sizeof(f64)); -{$ifdef arm} +{$ifdef cpuarm} { the arm fpu has a strange opinion how a double has to be stored } l:=f64.low; f64.low:=f64.high; f64.high:=l; -{$endif arm} +{$endif cpuarm} trunc:=float64_to_int32_round_to_zero(f64); end else @@ -267,13 +267,13 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint; sx: longint; f64 : float64; 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; i1 := cardinal(f64.low); sx := i0 and $80000000; @@ -303,6 +303,12 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint; f64.high := i0; f64.low := longint(i1 and not(cardinal($ffffffff) shr (j0 - 20))); 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); end; @@ -1180,7 +1186,10 @@ function fpc_int64_to_double(i : int64): double; compilerproc; { $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 * made some generic math code more readable diff --git a/rtl/inc/real2str.inc b/rtl/inc/real2str.inc index a763cd93ff..a19a19d462 100644 --- a/rtl/inc/real2str.inc +++ b/rtl/inc/real2str.inc @@ -283,11 +283,19 @@ begin {$error sign/NaN/Inf not yet supported for big endian CPU's in str_real} {$else SUPPORT_EXTENDED} {$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; expMaximal := ((TSplitDouble(d).cards[0] shr 20) and $7ff) = 2047; fraczero:= (TSplitDouble(d).cards[0] and $fffff = 0) and (TSplitDouble(d).cards[1] = 0); - { double, format (MSB): 1 Sign bit, 11 bit exponent, 52 bit mantissa } +{$endif CPUARM} {$else SUPPORT_DOUBLE} {$ifdef SUPPORT_SINGLE} { single, format (MSB): 1 Sign bit, 8 bit exponent, 23 bit mantissa } @@ -452,7 +460,10 @@ end; { $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 Revision 1.12 2003/12/08 17:45:00 peter