+ x86_64 dependend sysutils part added

* some 64 bit adaptions
This commit is contained in:
florian 2004-02-20 22:15:16 +00:00
parent c844c5a505
commit ff42d8657a
4 changed files with 93 additions and 18 deletions

View File

@ -176,6 +176,7 @@ Type
{$ifdef CPU64}
StrLenInt = Int64;
StrLenUInt = QWord;
SizeInt = Int64;
SizeUInt = QWord;
PtrInt = Int64;
@ -184,6 +185,7 @@ Type
{$ifdef CPU32}
StrLenInt = Longint;
StrLenUInt = DWord;
SizeInt = Longint;
SizeUInt = DWord;
PtrInt = Longint;
@ -726,7 +728,11 @@ const
{
$Log$
Revision 1.85 2004-02-20 11:01:20 daniel
Revision 1.86 2004-02-20 22:15:16 florian
+ x86_64 dependend sysutils part added
* some 64 bit adaptions
Revision 1.85 2004/02/20 11:01:20 daniel
* Applied
Revision 1.84 2004/02/02 20:39:27 florian
@ -887,4 +893,4 @@ const
instead of direct comparisons of low/high values of orddefs because
qword is a special case
}
}

View File

@ -85,8 +85,8 @@ end ;
{ StrPLCopy copies MaxLen or less characters from the pascal string
Source to Dest and returns Dest }
function StrPLCopy(Dest: PChar; Source: string; MaxLen: cardinal): PChar;
var Count: cardinal;
function StrPLCopy(Dest: PChar; Source: string; MaxLen: strlenuint): PChar;
var Count: strlenuint;
begin
result := Dest;
if (Result <> Nil) and (MaxLen <> 0) then begin
@ -112,17 +112,21 @@ end;
{ StrBufSize returns the amount of memory allocated for pchar Str allocated with StrAlloc }
function StrBufSize(Str: PChar): cardinal;
function StrBufSize(Str: PChar): strlenuint;
begin
if Str <> Nil then
result := cardinal(pointer(Str - SizeOf(cardinal))^)-sizeof(cardinal)
result := strlenuint(pointer(Str - SizeOf(strlenuint))^)-sizeof(strlenuint)
else
result := 0;
end ;
{
$Log$
Revision 1.1 2003-10-06 21:01:06 peter
Revision 1.2 2004-02-20 22:15:16 florian
+ x86_64 dependend sysutils part added
* some 64 bit adaptions
Revision 1.1 2003/10/06 21:01:06 peter
* moved classes unit to rtl
Revision 1.8 2003/09/06 21:52:24 marco

View File

@ -22,36 +22,40 @@
}
{ shared with strings unit }
function strlen(p : pchar) : longint;
function strlen(p : pchar) : strlenint;
function strcopy(dest,source : pchar) : pchar;
function strlcopy(dest,source : pchar;maxlen : longint) : pchar;
function strlcopy(dest,source : pchar;maxlen : strlenint) : pchar;
function strecopy(dest,source : pchar) : pchar;
function strend(p : pchar) : pchar;
function strcat(dest,source : pchar) : pchar;
function strcomp(str1,str2 : pchar) : longint;
function strlcomp(str1,str2 : pchar;l : longint) : longint;
function stricomp(str1,str2 : pchar) : longint;
function strmove(dest,source : pchar;l : longint) : pchar;
function strlcat(dest,source : pchar;l : longint) : pchar;
function strcomp(str1,str2 : pchar) : strlenint;
function strlcomp(str1,str2 : pchar;l : strlenint) : strlenint;
function stricomp(str1,str2 : pchar) : strlenint;
function strmove(dest,source : pchar;l : strlenint) : pchar;
function strlcat(dest,source : pchar;l : strlenint) : pchar;
function strscan(p : pchar;c : char) : pchar;
function strrscan(p : pchar;c : char) : pchar;
function strlower(p : pchar) : pchar;
function strupper(p : pchar) : pchar;
function strlicomp(str1,str2 : pchar;l : longint) : longint;
function strlicomp(str1,str2 : pchar;l : strlenint) : strlenint;
function strpos(str1,str2 : pchar) : pchar;
function strnew(p : pchar) : pchar;
{ Different from strings unit - ansistrings or different behaviour }
function StrPas(Str: PChar): string;
function StrPCopy(Dest: PChar; Source: string): PChar;
function StrPLCopy(Dest: PChar; Source: string; MaxLen: cardinal): PChar;
function StrPLCopy(Dest: PChar; Source: string; MaxLen: strlenuint): PChar;
function StrAlloc(Size: cardinal): PChar;
function StrBufSize(Str: PChar): cardinal;
function StrBufSize(Str: PChar): strlenuint;
procedure StrDispose(Str: PChar);
{
$Log$
Revision 1.1 2003-10-06 21:01:06 peter
Revision 1.2 2004-02-20 22:15:16 florian
+ x86_64 dependend sysutils part added
* some 64 bit adaptions
Revision 1.1 2003/10/06 21:01:06 peter
* moved classes unit to rtl
Revision 1.3 2002/09/07 16:01:22 peter

61
rtl/x86_64/sysutilp.inc Normal file
View File

@ -0,0 +1,61 @@
{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 2004 by Florian Klaempfl
member of the Free Pascal development team
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{ ---------------------------------------------------------------------
This include contains cpu-specific routines
---------------------------------------------------------------------}
function InterLockedDecrement (var Target: integer) : Integer; assembler;
asm
movl $-1,%edx
xchgl %edx,%eax
lock
xaddl %eax, (%rdx)
decl %eax
end;
function InterLockedIncrement (var Target: integer) : Integer; assembler;
asm
movl $1,%edx
xchgl %edx,%eax
lock
xaddl %eax, (%rdx)
incl %eax
end;
function InterLockedExchange (var Target: integer;Source : integer) : Integer; assembler;
asm
xchgl (%rax),%edx
movl %edx,%eax
end;
function InterLockedExchangeAdd (var Target: integer;Source : integer) : Integer; assembler;
asm
xchgl %eax,%edx
lock
xaddl %eax, (%rdx)
end;
{
$Log$
Revision 1.1 2004-02-20 22:15:16 florian
+ x86_64 dependend sysutils part added
* some 64 bit adaptions
}