mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-06 16:16:03 +02:00
* Convert clongdouble from double <=> quadruple on non-x86.
git-svn-id: trunk@8114 -
This commit is contained in:
parent
c5ac7638ed
commit
4861c8b7ed
@ -76,7 +76,8 @@ type
|
|||||||
{$ifdef windows}
|
{$ifdef windows}
|
||||||
clongdouble=double;
|
clongdouble=double;
|
||||||
{$else}
|
{$else}
|
||||||
{$define longdouble_assignment_overload}
|
{$ifdef x86}
|
||||||
|
{$define longdouble_assignment_overload_real80}
|
||||||
clongdouble = packed record
|
clongdouble = packed record
|
||||||
value:extended;
|
value:extended;
|
||||||
{$ifdef defined(cpu64) or defined(darwin)}
|
{$ifdef defined(cpu64) or defined(darwin)}
|
||||||
@ -85,6 +86,10 @@ type
|
|||||||
padding:array[0..1] of byte;
|
padding:array[0..1] of byte;
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
{$else}
|
||||||
|
{$define longdouble_assignment_overload_real128}
|
||||||
|
clongdouble = packed array [0..15] of byte;
|
||||||
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
Pclongdouble=^clongdouble;
|
Pclongdouble=^clongdouble;
|
||||||
|
|
||||||
@ -94,14 +99,20 @@ type
|
|||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$ifdef longdouble_assignment_overload}
|
{$ifdef longdouble_assignment_overload_real80}
|
||||||
operator := (const v:clongdouble):r:extended;
|
operator := (const v:clongdouble):r:extended;
|
||||||
operator := (const v:extended):r:clongdouble;
|
operator := (const v:extended):r:clongdouble;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
{$ifdef longdouble_assignment_overload_real128}
|
||||||
|
{Non-x86 typically doesn't have extended. To be fixed once this changes.}
|
||||||
|
operator := (const v:clongdouble):r:double;
|
||||||
|
operator := (const v:double):r:clongdouble;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$ifdef longdouble_assignment_overload}
|
{$ifdef longdouble_assignment_overload_real80}
|
||||||
operator := (const v:clongdouble):r:extended;inline;
|
operator := (const v:clongdouble):r:extended;inline;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -115,4 +126,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
{$ifdef longdouble_assignment_overload_real128}
|
||||||
|
|
||||||
|
{$ifdef ENDIAN_LITTLE}
|
||||||
|
const r128_mantissa_ofs=0;
|
||||||
|
r128_exponent_ofs=14;
|
||||||
|
{$else}
|
||||||
|
const r128_mantissa_ofs=2;
|
||||||
|
r128_exponent_ofs=0;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
operator := (const v:clongdouble):r:double;inline;
|
||||||
|
|
||||||
|
begin
|
||||||
|
qword(r):=(qword(Pword(@v[r128_exponent_ofs])^) shl 52) or
|
||||||
|
(Pqword(@v[r128_mantissa_ofs])^ shr 12);
|
||||||
|
end;
|
||||||
|
|
||||||
|
operator := (const v:double):r:clongdouble;inline;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Pword(@r[r128_exponent_ofs])^:=qword(v) shr 52;
|
||||||
|
Pqword(@r[r128_mantissa_ofs])^:=qword(v) shl 12;
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user