From 2fbe0038b9b8b2a92007397076ff64d43e34bae2 Mon Sep 17 00:00:00 2001 From: daniel Date: Sat, 21 Jul 2007 13:02:11 +0000 Subject: [PATCH] * Make clongdouble: - 8 bytes on windows - For other platforms: 12 bytes on 32-bit and 16 bytes on 64-bit cpus. ... using a record with assignment overloads. git-svn-id: trunk@8112 - --- rtl/inc/ctypes.pp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/rtl/inc/ctypes.pp b/rtl/inc/ctypes.pp index 462a7ce417..bb5cd8d838 100644 --- a/rtl/inc/ctypes.pp +++ b/rtl/inc/ctypes.pp @@ -72,7 +72,21 @@ type cfloat = single; pcfloat = ^cfloat; cdouble = double; pcdouble = ^cdouble; - clongdouble = extended; pclongdouble = ^clongdouble; + +{$ifdef windows} + clongdouble=double; +{$else} + {$define longdouble_assignment_overload} + clongdouble = packed record + value:extended; + {$ifdef cpu64} + padding:array[0..5] of byte; + {$else} + padding:array[0..1] of byte; + {$endif} + end; +{$endif} + Pclongdouble=^clongdouble; // Kylix compat types u_long = culong; @@ -80,6 +94,25 @@ type {$endif} +{$ifdef longdouble_assignment_overload} +operator := (const v:clongdouble):r:extended; +operator := (const v:extended):r:clongdouble; +{$endif} + implementation +{$ifdef longdouble_assignment_overload} +operator := (const v:clongdouble):r:extended;inline; + +begin + r:=v.value; +end; + +operator := (const v:extended):r:clongdouble;inline; + +begin + r.value:=v; +end; +{$endif} + end.