diff --git a/rtl/inc/genmath.inc b/rtl/inc/genmath.inc index fcd1c4f69b..a229775122 100644 --- a/rtl/inc/genmath.inc +++ b/rtl/inc/genmath.inc @@ -753,7 +753,11 @@ invalid: hi:=0.0; lo:=0.0; k:=0; +{$ifdef FPC_DOUBLE_HILO_SWAPPED} + hx:=float64(d).low; +{$else} hx:=float64(d).high; +{$endif FPC_DOUBLE_HILO_SWAPPED} xsb := (hx shr 31) and 1; { sign bit of d } hx := hx and $7fffffff; { high word of |d| } @@ -762,7 +766,11 @@ invalid: begin { if |d|>=709.78... } if hx >= $7ff00000 then begin +{$ifdef FPC_DOUBLE_HILO_SWAPPED} + lx:=float64(d).high; +{$else} lx:=float64(d).low; +{$endif FPC_DOUBLE_HILO_SWAPPED} if ((hx and $fffff) or lx)<>0 then begin result:=d+d; { NaN } @@ -829,14 +837,24 @@ invalid: if k >= -1021 then begin +{$ifdef FPC_DOUBLE_HILO_SWAPPED} + hy:=float64(y).low; + float64(y).low:=longint(hy)+(k shl 20); { add k to y's exponent } +{$else} hy:=float64(y).high; float64(y).high:=longint(hy)+(k shl 20); { add k to y's exponent } +{$endif FPC_DOUBLE_HILO_SWAPPED} result:=y; end else begin +{$ifdef FPC_DOUBLE_HILO_SWAPPED} + hy:=float64(y).low; + float64(y).low:=longint(hy)+((k+1000) shl 20); { add k to y's exponent } +{$else} hy:=float64(y).high; float64(y).high:=longint(hy)+((k+1000) shl 20); { add k to y's exponent } +{$endif FPC_DOUBLE_HILO_SWAPPED} result:=y*twom1000; end; end;