mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-04 17:45:28 +01:00
* fix alignment of tdoublearray by using a variant record
git-svn-id: trunk@3071 -
This commit is contained in:
parent
2cfd698273
commit
ecdb5df2d6
@ -81,7 +81,7 @@ interface
|
|||||||
{ range checking? }
|
{ range checking? }
|
||||||
if ((cs_check_range in aktlocalswitches) or
|
if ((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) and
|
(cs_check_overflow in aktlocalswitches)) and
|
||||||
(tai_real_32bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then
|
(tai_real_32bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then
|
||||||
Message(parser_e_range_check_error);
|
Message(parser_e_range_check_error);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ interface
|
|||||||
{ range checking? }
|
{ range checking? }
|
||||||
if ((cs_check_range in aktlocalswitches) or
|
if ((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) and
|
(cs_check_overflow in aktlocalswitches)) and
|
||||||
(tai_real_64bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then
|
(tai_real_64bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then
|
||||||
Message(parser_e_range_check_error);
|
Message(parser_e_range_check_error);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ interface
|
|||||||
{ range checking? }
|
{ range checking? }
|
||||||
if ((cs_check_range in aktlocalswitches) or
|
if ((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) and
|
(cs_check_overflow in aktlocalswitches)) and
|
||||||
(tai_real_80bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then
|
(tai_real_80bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then
|
||||||
Message(parser_e_range_check_error);
|
Message(parser_e_range_check_error);
|
||||||
end;
|
end;
|
||||||
{$ifdef cpufloat128}
|
{$ifdef cpufloat128}
|
||||||
@ -117,7 +117,7 @@ interface
|
|||||||
{ range checking? }
|
{ range checking? }
|
||||||
if ((cs_check_range in aktlocalswitches) or
|
if ((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) and
|
(cs_check_overflow in aktlocalswitches)) and
|
||||||
(tai_real_128bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then
|
(tai_real_128bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then
|
||||||
Message(parser_e_range_check_error);
|
Message(parser_e_range_check_error);
|
||||||
end;
|
end;
|
||||||
{$endif cpufloat128}
|
{$endif cpufloat128}
|
||||||
|
|||||||
@ -80,23 +80,23 @@ interface
|
|||||||
treelogfilename = 'tree.log';
|
treelogfilename = 'tree.log';
|
||||||
|
|
||||||
{$if defined(CPUARM) and defined(FPUFPA)}
|
{$if defined(CPUARM) and defined(FPUFPA)}
|
||||||
MathQNaN : tdoublearray = (0,0,252,255,0,0,0,0);
|
MathQNaN : tdoublerec = (bytes : (0,0,252,255,0,0,0,0));
|
||||||
MathInf : tdoublearray = (0,0,240,127,0,0,0,0);
|
MathInf : tdoublerec = (bytes : (0,0,240,127,0,0,0,0));
|
||||||
MathNegInf : tdoublearray = (0,0,240,255,0,0,0,0);
|
MathNegInf : tdoublerec = (bytes : (0,0,240,255,0,0,0,0));
|
||||||
MathPi : tdoublearray = (251,33,9,64,24,45,68,84);
|
MathPi : tdoublerec = (bytes : (251,33,9,64,24,45,68,84));
|
||||||
{$else}
|
{$else}
|
||||||
{$ifdef FPC_LITTLE_ENDIAN}
|
{$ifdef FPC_LITTLE_ENDIAN}
|
||||||
MathQNaN : tdoublearray = (0,0,0,0,0,0,252,255);
|
MathQNaN : tdoublerec = (bytes : (0,0,0,0,0,0,252,255));
|
||||||
MathInf : tdoublearray = (0,0,0,0,0,0,240,127);
|
MathInf : tdoublerec = (bytes : (0,0,0,0,0,0,240,127));
|
||||||
MathNegInf : tdoublearray = (0,0,0,0,0,0,240,255);
|
MathNegInf : tdoublerec = (bytes : (0,0,0,0,0,0,240,255));
|
||||||
MathPi : tdoublearray = (24,45,68,84,251,33,9,64);
|
MathPi : tdoublerec = (bytes : (24,45,68,84,251,33,9,64));
|
||||||
MathPiExtended : textendedarray = (53,194,104,33,162,218,15,201,0,64);
|
MathPiExtended : textendedrec = (bytes : (53,194,104,33,162,218,15,201,0,64));
|
||||||
{$else FPC_LITTLE_ENDIAN}
|
{$else FPC_LITTLE_ENDIAN}
|
||||||
MathQNaN : tdoublearray = (255,252,0,0,0,0,0,0);
|
MathQNaN : tdoublerec = (bytes : (255,252,0,0,0,0,0,0));
|
||||||
MathInf : tdoublearray = (127,240,0,0,0,0,0,0);
|
MathInf : tdoublerec = (bytes : (127,240,0,0,0,0,0,0));
|
||||||
MathNegInf : tdoublearray = (255,240,0,0,0,0,0,0);
|
MathNegInf : tdoublerec = (bytes : (255,240,0,0,0,0,0,0));
|
||||||
MathPi : tdoublearray = (64,9,33,251,84,68,45,24);
|
MathPi : tdoublerec = (bytes : (64,9,33,251,84,68,45,24));
|
||||||
MathPiExtended : textendedarray = (64,0,201,15,218,162,33,104,194,53);
|
MathPiExtended : textendedrec = (bytes : (64,0,201,15,218,162,33,104,194,53));
|
||||||
{$endif FPC_LITTLE_ENDIAN}
|
{$endif FPC_LITTLE_ENDIAN}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
@ -1858,15 +1858,15 @@ end;
|
|||||||
result := -1;
|
result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function convertdoublearray(d : tdoublearray) : tdoublearray;{$ifdef USEINLINE}inline;{$endif}
|
function convertdoublerec(d : tdoublerec) : tdoublerec;{$ifdef USEINLINE}inline;{$endif}
|
||||||
{$ifdef CPUARM}
|
{$ifdef CPUARM}
|
||||||
var
|
var
|
||||||
i : longint;
|
i : longint;
|
||||||
begin
|
begin
|
||||||
for i:=0 to 3 do
|
for i:=0 to 3 do
|
||||||
begin
|
begin
|
||||||
result[i+4]:=d[i];
|
result.bytes[i+4]:=d.bytes[i];
|
||||||
result[i]:=d[i+4];
|
result.bytes[i]:=d.bytes[i+4];
|
||||||
end;
|
end;
|
||||||
{$else CPUARM}
|
{$else CPUARM}
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -67,8 +67,17 @@ than 255 characters. That's why using Ansi Strings}
|
|||||||
int64 constants internally (JM) }
|
int64 constants internally (JM) }
|
||||||
TConstPtrUInt = AWord;
|
TConstPtrUInt = AWord;
|
||||||
|
|
||||||
tdoublearray = array[0..7] of byte;
|
{ Use a variant record to be sure that the array if aligned correctly }
|
||||||
textendedarray = array[0..9] of byte;
|
tdoublerec=record
|
||||||
|
case byte of
|
||||||
|
0 : (bytes:array[0..7] of byte);
|
||||||
|
1 : (value:double);
|
||||||
|
end;
|
||||||
|
textendedrec=record
|
||||||
|
case byte of
|
||||||
|
0 : (bytes:array[0..9] of byte);
|
||||||
|
1 : (value:extended);
|
||||||
|
end;
|
||||||
|
|
||||||
pconstset = ^tconstset;
|
pconstset = ^tconstset;
|
||||||
tconstset = set of 0..255;
|
tconstset = set of 0..255;
|
||||||
|
|||||||
@ -148,7 +148,7 @@ implementation
|
|||||||
{ range checking? }
|
{ range checking? }
|
||||||
if ((cs_check_range in aktlocalswitches) or
|
if ((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) and
|
(cs_check_overflow in aktlocalswitches)) and
|
||||||
(tai_real_32bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then
|
(tai_real_32bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then
|
||||||
Message(parser_e_range_check_error);
|
Message(parser_e_range_check_error);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ implementation
|
|||||||
{ range checking? }
|
{ range checking? }
|
||||||
if ((cs_check_range in aktlocalswitches) or
|
if ((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) and
|
(cs_check_overflow in aktlocalswitches)) and
|
||||||
(tai_real_64bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then
|
(tai_real_64bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then
|
||||||
Message(parser_e_range_check_error);
|
Message(parser_e_range_check_error);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ implementation
|
|||||||
{ range checking? }
|
{ range checking? }
|
||||||
if ((cs_check_range in aktlocalswitches) or
|
if ((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) and
|
(cs_check_overflow in aktlocalswitches)) and
|
||||||
(tai_real_80bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then
|
(tai_real_80bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then
|
||||||
Message(parser_e_range_check_error);
|
Message(parser_e_range_check_error);
|
||||||
end;
|
end;
|
||||||
{$ifdef cpufloat128}
|
{$ifdef cpufloat128}
|
||||||
@ -186,7 +186,7 @@ implementation
|
|||||||
{ range checking? }
|
{ range checking? }
|
||||||
if ((cs_check_range in aktlocalswitches) or
|
if ((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) and
|
(cs_check_overflow in aktlocalswitches)) and
|
||||||
(tai_real_128bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then
|
(tai_real_128bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then
|
||||||
Message(parser_e_range_check_error);
|
Message(parser_e_range_check_error);
|
||||||
end;
|
end;
|
||||||
{$endif cpufloat128}
|
{$endif cpufloat128}
|
||||||
|
|||||||
@ -1085,9 +1085,9 @@ implementation
|
|||||||
result:=pi;
|
result:=pi;
|
||||||
{$else x86}
|
{$else x86}
|
||||||
{$ifdef cpuextended}
|
{$ifdef cpuextended}
|
||||||
result:=extended(MathPiExtended);
|
result:=MathPiExtended.Value;
|
||||||
{$else cpuextended}
|
{$else cpuextended}
|
||||||
result:=double(MathPi);
|
result:=MathPi.Value;
|
||||||
{$endif cpuextended}
|
{$endif cpuextended}
|
||||||
{$endif x86}
|
{$endif x86}
|
||||||
end;
|
end;
|
||||||
@ -1189,9 +1189,9 @@ implementation
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if r=0.0 then
|
if r=0.0 then
|
||||||
result:=crealconstnode.create(double(MathQNaN),pbestrealtype^)
|
result:=crealconstnode.create(MathQNaN.Value,pbestrealtype^)
|
||||||
else
|
else
|
||||||
result:=crealconstnode.create(double(MathNegInf),pbestrealtype^)
|
result:=crealconstnode.create(MathNegInf.Value,pbestrealtype^)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
result:=crealconstnode.create(ln(r),pbestrealtype^)
|
result:=crealconstnode.create(ln(r),pbestrealtype^)
|
||||||
@ -1208,7 +1208,7 @@ implementation
|
|||||||
CGMessage(type_e_wrong_math_argument)
|
CGMessage(type_e_wrong_math_argument)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
result:=crealconstnode.create(double(MathQNaN),pbestrealtype^)
|
result:=crealconstnode.create(MathQNaN.Value,pbestrealtype^)
|
||||||
else
|
else
|
||||||
result:=crealconstnode.create(sqrt(r),pbestrealtype^)
|
result:=crealconstnode.create(sqrt(r),pbestrealtype^)
|
||||||
end;
|
end;
|
||||||
@ -1828,7 +1828,7 @@ implementation
|
|||||||
if left.nodetype in [ordconstn,realconstn] then
|
if left.nodetype in [ordconstn,realconstn] then
|
||||||
begin
|
begin
|
||||||
result:=crealconstnode.create(exp(getconstrealvalue),pbestrealtype^);
|
result:=crealconstnode.create(exp(getconstrealvalue),pbestrealtype^);
|
||||||
if (trealconstnode(result).value_real=double(MathInf)) and
|
if (trealconstnode(result).value_real=MathInf.Value) and
|
||||||
((cs_check_range in aktlocalswitches) or
|
((cs_check_range in aktlocalswitches) or
|
||||||
(cs_check_overflow in aktlocalswitches)) then
|
(cs_check_overflow in aktlocalswitches)) then
|
||||||
begin
|
begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user