From 834dbf5f802a9a71982749f0c58a65c08da5074e Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 13 Jul 2020 13:18:32 +0000 Subject: [PATCH] Also use union with double field to ensure correct alignment for float64 type from genmath.inc source git-svn-id: trunk@45779 - --- rtl/inc/genmath.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rtl/inc/genmath.inc b/rtl/inc/genmath.inc index 8821f05faf..0183dcd1b2 100644 --- a/rtl/inc/genmath.inc +++ b/rtl/inc/genmath.inc @@ -62,21 +62,26 @@ type PReal = ^Real; { also necessary for Int() on systems with 64bit floats (JM) } +{ union required to get correct alignement for floating point type } {$ifndef FPC_SYSTEM_HAS_float64} {$ifdef ENDIAN_LITTLE} float64 = record -{$ifndef FPC_DOUBLE_HILO_SWAPPED} - low,high: longint; + case byte of + 1: (dummy : double); + {$ifndef FPC_DOUBLE_HILO_SWAPPED} + 2: (low,high: longint); {$else} - high,low: longint; + 2: (high,low: longint); {$endif FPC_DOUBLE_HILO_SWAPPED} end; {$else} float64 = record + case byte of + 1: (dummy : double); {$ifndef FPC_DOUBLE_HILO_SWAPPED} - high,low: longint; + 2: (high,low: longint); {$else} - low,high: longint; + 2: (low,high: longint); {$endif FPC_DOUBLE_HILO_SWAPPED} end; {$endif}