mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 14:09:17 +02:00
* ValSInt fixed for 64 bit
This commit is contained in:
parent
6d19671a84
commit
b5df63e617
@ -210,8 +210,10 @@ Procedure fpc_Read_Text_Char(var f : Text; var c : char); compilerproc;
|
|||||||
Procedure fpc_Read_Text_SInt(var f : Text; var l :ValSInt); compilerproc;
|
Procedure fpc_Read_Text_SInt(var f : Text; var l :ValSInt); compilerproc;
|
||||||
Procedure fpc_Read_Text_UInt(var f : Text; var u :ValUInt); compilerproc;
|
Procedure fpc_Read_Text_UInt(var f : Text; var u :ValUInt); compilerproc;
|
||||||
Procedure fpc_Read_Text_Float(var f : Text; var v :ValReal); compilerproc;
|
Procedure fpc_Read_Text_Float(var f : Text; var v :ValReal); compilerproc;
|
||||||
|
{$ifndef CPU64}
|
||||||
Procedure fpc_Read_Text_QWord(var f : text; var q : qword); compilerproc;
|
Procedure fpc_Read_Text_QWord(var f : text; var q : qword); compilerproc;
|
||||||
Procedure fpc_Read_Text_Int64(var f : text; var i : int64); compilerproc;
|
Procedure fpc_Read_Text_Int64(var f : text; var i : int64); compilerproc;
|
||||||
|
{$endif CPU64}
|
||||||
|
|
||||||
{$ifdef FPC_INCLUDE_SOFTWARE_MOD_DIV}
|
{$ifdef FPC_INCLUDE_SOFTWARE_MOD_DIV}
|
||||||
function fpc_div_dword(n,z : dword) : dword; compilerproc;
|
function fpc_div_dword(n,z : dword) : dword; compilerproc;
|
||||||
@ -328,7 +330,10 @@ function fpc_qword_to_double(q: qword): double; compilerproc;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.54 2004-04-29 19:50:13 peter
|
Revision 1.55 2004-05-01 20:52:50 peter
|
||||||
|
* ValSInt fixed for 64 bit
|
||||||
|
|
||||||
|
Revision 1.54 2004/04/29 19:50:13 peter
|
||||||
* x86-64 fixes
|
* x86-64 fixes
|
||||||
|
|
||||||
Revision 1.53 2004/04/29 18:59:43 peter
|
Revision 1.53 2004/04/29 18:59:43 peter
|
||||||
|
@ -1150,6 +1150,66 @@ end;
|
|||||||
|
|
||||||
{$endif ndef FPC_SYSTEM_HAS_INT_STR_LONGWORD}
|
{$endif ndef FPC_SYSTEM_HAS_INT_STR_LONGWORD}
|
||||||
|
|
||||||
|
{$ifndef FPC_SYSTEM_HAS_INT_STR_INT64}
|
||||||
|
|
||||||
|
procedure int_str(l : int64;var s : string);
|
||||||
|
var
|
||||||
|
value: int64;
|
||||||
|
negative: boolean;
|
||||||
|
|
||||||
|
begin
|
||||||
|
negative := false;
|
||||||
|
s:='';
|
||||||
|
{ Workaround: }
|
||||||
|
if l=int64($8000000000000000) then
|
||||||
|
begin
|
||||||
|
s:='-9223372036854775808';
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
{ handle case where l = 0 }
|
||||||
|
if l = 0 then
|
||||||
|
begin
|
||||||
|
s:='0';
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
If l < 0 then
|
||||||
|
begin
|
||||||
|
negative := true;
|
||||||
|
value:=abs(l);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
value:=l;
|
||||||
|
{ handle non-zero case }
|
||||||
|
while value>0 do
|
||||||
|
begin
|
||||||
|
s:=char((value mod 10)+ord('0'))+s;
|
||||||
|
value := value div 10;
|
||||||
|
end;
|
||||||
|
if negative then
|
||||||
|
s := '-' + s;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$endif ndef FPC_SYSTEM_HAS_INT_STR_INT64}
|
||||||
|
|
||||||
|
{$ifndef FPC_SYSTEM_HAS_INT_STR_QWORD}
|
||||||
|
|
||||||
|
procedure int_str(l : qword;var s : string);
|
||||||
|
begin
|
||||||
|
s:='';
|
||||||
|
if l = 0 then
|
||||||
|
begin
|
||||||
|
s := '0';
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
while l>0 do
|
||||||
|
begin
|
||||||
|
s:=char(ord('0')+(l mod 10))+s;
|
||||||
|
l:=l div 10;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$endif ndef FPC_SYSTEM_HAS_INT_STR_QWORD}
|
||||||
|
|
||||||
{$ifndef FPC_SYSTEM_HAS_SYSRESETFPU}
|
{$ifndef FPC_SYSTEM_HAS_SYSRESETFPU}
|
||||||
|
|
||||||
procedure SysResetFpu;
|
procedure SysResetFpu;
|
||||||
@ -1161,7 +1221,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.74 2004-05-01 15:26:33 jonas
|
Revision 1.75 2004-05-01 20:52:50 peter
|
||||||
|
* ValSInt fixed for 64 bit
|
||||||
|
|
||||||
|
Revision 1.74 2004/05/01 15:26:33 jonas
|
||||||
* use some more string routines from libc if FPC_USE_LIBC is used
|
* use some more string routines from libc if FPC_USE_LIBC is used
|
||||||
|
|
||||||
Revision 1.73 2004/04/29 19:50:13 peter
|
Revision 1.73 2004/04/29 19:50:13 peter
|
||||||
|
@ -378,40 +378,17 @@ end;
|
|||||||
|
|
||||||
{$ifndef CPU64}
|
{$ifndef CPU64}
|
||||||
|
|
||||||
procedure int_qword_str(value : qword;var s : string);
|
|
||||||
var
|
|
||||||
hs : string;
|
|
||||||
begin
|
|
||||||
hs:='';
|
|
||||||
repeat
|
|
||||||
hs:=chr(longint(value mod qword(10))+48)+hs;
|
|
||||||
value:=value div qword(10);
|
|
||||||
until value=0;
|
|
||||||
s:=hs;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure fpc_shortstr_qword(v : qword;len : longint;var s : shortstring);[public,alias:'FPC_SHORTSTR_QWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
|
procedure fpc_shortstr_qword(v : qword;len : longint;var s : shortstring);[public,alias:'FPC_SHORTSTR_QWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
|
||||||
begin
|
begin
|
||||||
int_qword_str(v,s);
|
int_str(v,s);
|
||||||
if length(s)<len then
|
if length(s)<len then
|
||||||
s:=space(len-length(s))+s;
|
s:=space(len-length(s))+s;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure fpc_shortstr_int64(v : int64;len : longint;var s : shortstring);[public,alias:'FPC_SHORTSTR_INT64']; {$ifdef hascompilerproc} compilerproc; {$endif}
|
procedure fpc_shortstr_int64(v : int64;len : longint;var s : shortstring);[public,alias:'FPC_SHORTSTR_INT64']; {$ifdef hascompilerproc} compilerproc; {$endif}
|
||||||
var
|
|
||||||
hs : shortstring;
|
|
||||||
q : qword;
|
|
||||||
begin
|
begin
|
||||||
if v<0 then
|
int_str(v,s);
|
||||||
begin
|
|
||||||
q:=qword(-v);
|
|
||||||
int_qword_str(q,hs);
|
|
||||||
s:='-'+hs;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
int_qword_str(qword(v),s);
|
|
||||||
if length(s)<len then
|
if length(s)<len then
|
||||||
s:=space(len-length(s))+s;
|
s:=space(len-length(s))+s;
|
||||||
end;
|
end;
|
||||||
@ -482,7 +459,7 @@ var
|
|||||||
ss : shortstring;
|
ss : shortstring;
|
||||||
maxlen : StrLenInt;
|
maxlen : StrLenInt;
|
||||||
begin
|
begin
|
||||||
int_qword_str(v,ss);
|
int_str(v,ss);
|
||||||
if length(ss)<len then
|
if length(ss)<len then
|
||||||
ss:=space(len-length(ss))+ss;
|
ss:=space(len-length(ss))+ss;
|
||||||
if length(ss)<high(a)+1 then
|
if length(ss)<high(a)+1 then
|
||||||
@ -497,16 +474,8 @@ procedure fpc_chararray_int64(v : int64;len : StrLenInt;var a : array of char);{
|
|||||||
var
|
var
|
||||||
ss : shortstring;
|
ss : shortstring;
|
||||||
maxlen : StrLenInt;
|
maxlen : StrLenInt;
|
||||||
q : qword;
|
|
||||||
begin
|
begin
|
||||||
if v<0 then
|
int_str(v,ss);
|
||||||
begin
|
|
||||||
q:=qword(-v);
|
|
||||||
int_qword_str(q,ss);
|
|
||||||
ss:='-'+ss;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
int_qword_str(qword(v),ss);
|
|
||||||
if length(ss)<len then
|
if length(ss)<len then
|
||||||
ss:=space(len-length(ss))+ss;
|
ss:=space(len-length(ss))+ss;
|
||||||
if length(ss)<high(a)+1 then
|
if length(ss)<high(a)+1 then
|
||||||
@ -893,7 +862,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.28 2004-04-29 18:59:43 peter
|
Revision 1.29 2004-05-01 20:52:50 peter
|
||||||
|
* ValSInt fixed for 64 bit
|
||||||
|
|
||||||
|
Revision 1.28 2004/04/29 18:59:43 peter
|
||||||
* str() helpers now also use valint/valuint
|
* str() helpers now also use valint/valuint
|
||||||
* int64/qword helpers disabled for cpu64
|
* int64/qword helpers disabled for cpu64
|
||||||
|
|
||||||
|
@ -94,8 +94,6 @@ Type
|
|||||||
{$define SUPPORT_EXTENDED}
|
{$define SUPPORT_EXTENDED}
|
||||||
{$define SUPPORT_COMP}
|
{$define SUPPORT_COMP}
|
||||||
|
|
||||||
ValSInt = Longint;
|
|
||||||
ValUInt = Cardinal;
|
|
||||||
ValReal = Extended;
|
ValReal = Extended;
|
||||||
{$endif CPUI386}
|
{$endif CPUI386}
|
||||||
|
|
||||||
@ -107,14 +105,10 @@ Type
|
|||||||
{$define SUPPORT_EXTENDED}
|
{$define SUPPORT_EXTENDED}
|
||||||
{$define SUPPORT_COMP}
|
{$define SUPPORT_COMP}
|
||||||
|
|
||||||
ValSInt = Longint;
|
|
||||||
ValUInt = Cardinal;
|
|
||||||
ValReal = Extended;
|
ValReal = Extended;
|
||||||
{$endif CPUX86_64}
|
{$endif CPUX86_64}
|
||||||
|
|
||||||
{$ifdef CPUM68K}
|
{$ifdef CPUM68K}
|
||||||
ValSInt = Longint;
|
|
||||||
ValUInt = Cardinal;
|
|
||||||
ValReal = Real;
|
ValReal = Real;
|
||||||
|
|
||||||
{ Comp type does not exist on fpu }
|
{ Comp type does not exist on fpu }
|
||||||
@ -139,8 +133,6 @@ Type
|
|||||||
|
|
||||||
{$define FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
|
{$define FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
|
||||||
|
|
||||||
ValSInt = Longint;
|
|
||||||
ValUInt = Cardinal;
|
|
||||||
ValReal = Double;
|
ValReal = Double;
|
||||||
|
|
||||||
{ map comp to int64, but this doesn't mean we compile the comp support in! }
|
{ map comp to int64, but this doesn't mean we compile the comp support in! }
|
||||||
@ -154,8 +146,6 @@ Type
|
|||||||
{$define SUPPORT_SINGLE}
|
{$define SUPPORT_SINGLE}
|
||||||
{$define SUPPORT_DOUBLE}
|
{$define SUPPORT_DOUBLE}
|
||||||
|
|
||||||
ValSInt = Longint;
|
|
||||||
ValUInt = Cardinal;
|
|
||||||
ValReal = Double;
|
ValReal = Double;
|
||||||
|
|
||||||
{ map comp to int64, but this doesn't mean we compile the comp support in! }
|
{ map comp to int64, but this doesn't mean we compile the comp support in! }
|
||||||
@ -189,6 +179,8 @@ Type
|
|||||||
SizeUInt = QWord;
|
SizeUInt = QWord;
|
||||||
PtrInt = Int64;
|
PtrInt = Int64;
|
||||||
PtrUInt = QWord;
|
PtrUInt = QWord;
|
||||||
|
ValSInt = int64;
|
||||||
|
ValUInt = qword;
|
||||||
{$endif CPU64}
|
{$endif CPU64}
|
||||||
|
|
||||||
{$ifdef CPU32}
|
{$ifdef CPU32}
|
||||||
@ -198,6 +190,8 @@ Type
|
|||||||
SizeUInt = DWord;
|
SizeUInt = DWord;
|
||||||
PtrInt = Longint;
|
PtrInt = Longint;
|
||||||
PtrUInt = DWord;
|
PtrUInt = DWord;
|
||||||
|
ValSInt = Longint;
|
||||||
|
ValUInt = Cardinal;
|
||||||
{$endif CPU32}
|
{$endif CPU32}
|
||||||
|
|
||||||
{ Zero - terminated strings }
|
{ Zero - terminated strings }
|
||||||
@ -737,7 +731,10 @@ const
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.89 2004-04-29 18:59:43 peter
|
Revision 1.90 2004-05-01 20:52:50 peter
|
||||||
|
* ValSInt fixed for 64 bit
|
||||||
|
|
||||||
|
Revision 1.89 2004/04/29 18:59:43 peter
|
||||||
* str() helpers now also use valint/valuint
|
* str() helpers now also use valint/valuint
|
||||||
* int64/qword helpers disabled for cpu64
|
* int64/qword helpers disabled for cpu64
|
||||||
|
|
||||||
|
@ -1011,7 +1011,7 @@ Function fpc_Read_Text_SInt(var f : Text):ValSInt;[Public,Alias:'FPC_READ_TEXT_S
|
|||||||
{$endif hascompilerproc}
|
{$endif hascompilerproc}
|
||||||
var
|
var
|
||||||
hs : String;
|
hs : String;
|
||||||
code : Longint;
|
code : longint;
|
||||||
Begin
|
Begin
|
||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
l:=0;
|
l:=0;
|
||||||
@ -1148,6 +1148,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{$ifndef cpu64}
|
||||||
|
|
||||||
{$ifdef hascompilerproc}
|
{$ifdef hascompilerproc}
|
||||||
procedure fpc_Read_Text_QWord(var f : text; var q : qword); iocheck; [public,alias:'FPC_READ_TEXT_QWORD']; compilerproc;
|
procedure fpc_Read_Text_QWord(var f : text; var q : qword); iocheck; [public,alias:'FPC_READ_TEXT_QWORD']; compilerproc;
|
||||||
{$else hascompilerproc}
|
{$else hascompilerproc}
|
||||||
@ -1242,6 +1244,8 @@ Begin
|
|||||||
InOutRes:=106;
|
InOutRes:=106;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
{$endif CPU64}
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Initializing
|
Initializing
|
||||||
@ -1269,7 +1273,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.22 2004-04-29 18:59:43 peter
|
Revision 1.23 2004-05-01 20:52:50 peter
|
||||||
|
* ValSInt fixed for 64 bit
|
||||||
|
|
||||||
|
Revision 1.22 2004/04/29 18:59:43 peter
|
||||||
* str() helpers now also use valint/valuint
|
* str() helpers now also use valint/valuint
|
||||||
* int64/qword helpers disabled for cpu64
|
* int64/qword helpers disabled for cpu64
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user