mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 18:29:09 +02:00
* fixed return value when len=0 for indexchar,indexword
This commit is contained in:
parent
772d7147cd
commit
8bb7e03d19
@ -29,7 +29,7 @@ asm
|
|||||||
movl source,%esi
|
movl source,%esi
|
||||||
movl %edi,%eax
|
movl %edi,%eax
|
||||||
movl count,%ebx
|
movl count,%ebx
|
||||||
{ check for zero or negative count }
|
{ check for zero or negative count }
|
||||||
cmpl $0,%ebx
|
cmpl $0,%ebx
|
||||||
jle .LMoveEnd
|
jle .LMoveEnd
|
||||||
{ Check for back or forward }
|
{ Check for back or forward }
|
||||||
@ -102,7 +102,7 @@ asm
|
|||||||
movl x,%edi
|
movl x,%edi
|
||||||
movb value,%al
|
movb value,%al
|
||||||
movl count,%ecx
|
movl count,%ecx
|
||||||
{ check for zero or negative count }
|
{ check for zero or negative count }
|
||||||
cmpl $0,%ecx
|
cmpl $0,%ecx
|
||||||
jle .LFillEnd
|
jle .LFillEnd
|
||||||
cmpl $7,%ecx
|
cmpl $7,%ecx
|
||||||
@ -127,7 +127,7 @@ asm
|
|||||||
.LFill1:
|
.LFill1:
|
||||||
rep
|
rep
|
||||||
stosb
|
stosb
|
||||||
.LFillEnd:
|
.LFillEnd:
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ procedure fillword(var x;count : longint;value : word);assembler;
|
|||||||
asm
|
asm
|
||||||
movl x,%edi
|
movl x,%edi
|
||||||
movl count,%ecx
|
movl count,%ecx
|
||||||
{ check for zero or negative count }
|
{ check for zero or negative count }
|
||||||
cmpl $0,%ecx
|
cmpl $0,%ecx
|
||||||
jle .LFillWordEnd
|
jle .LFillWordEnd
|
||||||
movzwl value,%eax
|
movzwl value,%eax
|
||||||
@ -152,7 +152,7 @@ asm
|
|||||||
andl $1,%ecx
|
andl $1,%ecx
|
||||||
rep
|
rep
|
||||||
stosw
|
stosw
|
||||||
.LFillWordEnd:
|
.LFillWordEnd:
|
||||||
end ['EAX','ECX','EDX','EDI'];
|
end ['EAX','ECX','EDX','EDI'];
|
||||||
|
|
||||||
|
|
||||||
@ -161,20 +161,21 @@ procedure filldword(var x;count : longint;value : dword);assembler;
|
|||||||
asm
|
asm
|
||||||
movl x,%edi
|
movl x,%edi
|
||||||
movl count,%ecx
|
movl count,%ecx
|
||||||
{ check for zero or negative count }
|
{ check for zero or negative count }
|
||||||
cmpl $0,%ecx
|
cmpl $0,%ecx
|
||||||
jle .LFillDWordEnd
|
jle .LFillDWordEnd
|
||||||
movl value,%eax
|
movl value,%eax
|
||||||
cld
|
cld
|
||||||
rep
|
rep
|
||||||
stosl
|
stosl
|
||||||
.LFillDWordEnd:
|
.LFillDWordEnd:
|
||||||
end ['EAX','ECX','EDX','EDI'];
|
end ['EAX','ECX','EDX','EDI'];
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_INDEXBYTE}
|
{$define FPC_SYSTEM_HAS_INDEXBYTE}
|
||||||
function IndexByte(Const buf;len:longint;b:byte):longint; assembler;
|
function IndexByte(Const buf;len:longint;b:byte):longint; assembler;
|
||||||
asm
|
asm
|
||||||
|
xorl %eax,%eax
|
||||||
movl Len,%ecx // Load len
|
movl Len,%ecx // Load len
|
||||||
movl Buf,%edi // Load String
|
movl Buf,%edi // Load String
|
||||||
testl %ecx,%ecx
|
testl %ecx,%ecx
|
||||||
@ -198,6 +199,7 @@ end ['EAX','EBX','ECX','EDI'];
|
|||||||
{$define FPC_SYSTEM_HAS_INDEXWORD}
|
{$define FPC_SYSTEM_HAS_INDEXWORD}
|
||||||
function Indexword(Const buf;len:longint;b:word):longint; assembler;
|
function Indexword(Const buf;len:longint;b:word):longint; assembler;
|
||||||
asm
|
asm
|
||||||
|
xorl %eax,%eax
|
||||||
movl Len,%ecx // Load len
|
movl Len,%ecx // Load len
|
||||||
movl Buf,%edi // Load String
|
movl Buf,%edi // Load String
|
||||||
testl %ecx,%ecx
|
testl %ecx,%ecx
|
||||||
@ -221,6 +223,7 @@ end ['EAX','EBX','ECX','EDI'];
|
|||||||
{$define FPC_SYSTEM_HAS_INDEXDWORD}
|
{$define FPC_SYSTEM_HAS_INDEXDWORD}
|
||||||
function IndexDWord(Const buf;len:longint;b:DWord):longint; assembler;
|
function IndexDWord(Const buf;len:longint;b:DWord):longint; assembler;
|
||||||
asm
|
asm
|
||||||
|
xorl %eax,%eax
|
||||||
movl Len,%ecx // Load len
|
movl Len,%ecx // Load len
|
||||||
movl Buf,%edi // Load String
|
movl Buf,%edi // Load String
|
||||||
testl %ecx,%ecx
|
testl %ecx,%ecx
|
||||||
@ -1210,7 +1213,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.35 2002-10-20 11:50:57 carl
|
Revision 1.36 2002-12-15 22:32:25 peter
|
||||||
|
* fixed return value when len=0 for indexchar,indexword
|
||||||
|
|
||||||
|
Revision 1.35 2002/10/20 11:50:57 carl
|
||||||
* avoid crashes with negative len counts on fills/moves
|
* avoid crashes with negative len counts on fills/moves
|
||||||
|
|
||||||
Revision 1.34 2002/10/15 19:24:47 carl
|
Revision 1.34 2002/10/15 19:24:47 carl
|
||||||
|
Loading…
Reference in New Issue
Block a user