mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 02:19:27 +02:00
* fix Fill* code for CPUs with 8 Bit ALU
git-svn-id: trunk@32645 -
This commit is contained in:
parent
b80d4a9a6c
commit
91c59cb512
@ -133,18 +133,22 @@ end;
|
|||||||
Procedure FillChar(var x;count:SizeInt;value:byte);
|
Procedure FillChar(var x;count:SizeInt;value:byte);
|
||||||
var
|
var
|
||||||
pdest,pend : pbyte;
|
pdest,pend : pbyte;
|
||||||
v : ptruint;
|
v : ALUUInt;
|
||||||
begin
|
begin
|
||||||
if count <= 0 then
|
if count <= 0 then
|
||||||
exit;
|
exit;
|
||||||
pdest:=@x;
|
pdest:=@x;
|
||||||
if Count>4*sizeof(ptruint)-1 then
|
if Count>4*sizeof(ptruint)-1 then
|
||||||
begin
|
begin
|
||||||
|
{$if sizeof(v)>=2}
|
||||||
v:=(value shl 8) or value;
|
v:=(value shl 8) or value;
|
||||||
|
{$endif sizeof(v)>=2}
|
||||||
|
{$if sizeof(v)>=4}
|
||||||
v:=(v shl 16) or v;
|
v:=(v shl 16) or v;
|
||||||
{$ifdef CPU64}
|
{$endif sizeof(v)>=4}
|
||||||
|
{$if sizeof(v)=8}
|
||||||
v:=(v shl 32) or v;
|
v:=(v shl 32) or v;
|
||||||
{$endif CPU64}
|
{$endif sizeof(v)=8}
|
||||||
{ Align on native pointer size }
|
{ Align on native pointer size }
|
||||||
pend:=pbyte(align(pdest,sizeof(PtrUInt)));
|
pend:=pbyte(align(pdest,sizeof(PtrUInt)));
|
||||||
dec(count,pend-pdest);
|
dec(count,pend-pdest);
|
||||||
@ -177,17 +181,19 @@ procedure fillword(var x;count : SizeInt;value : word);
|
|||||||
var
|
var
|
||||||
aligncount : sizeint;
|
aligncount : sizeint;
|
||||||
pdest,pend : pword;
|
pdest,pend : pword;
|
||||||
v : ptruint;
|
v : ALUUInt;
|
||||||
begin
|
begin
|
||||||
if count <= 0 then
|
if count <= 0 then
|
||||||
exit;
|
exit;
|
||||||
pdest:=@x;
|
pdest:=@x;
|
||||||
if Count>4*sizeof(ptruint)-1 then
|
if Count>4*sizeof(ptruint)-1 then
|
||||||
begin
|
begin
|
||||||
|
{$if sizeof(v)>=4}
|
||||||
v:=(value shl 16) or value;
|
v:=(value shl 16) or value;
|
||||||
{$ifdef CPU64}
|
{$endif sizeof(v)>=4}
|
||||||
|
{$if sizeof(v)=8}
|
||||||
v:=(v shl 32) or v;
|
v:=(v shl 32) or v;
|
||||||
{$endif CPU64}
|
{$endif sizeof(v)=8}
|
||||||
{ Align on native pointer size }
|
{ Align on native pointer size }
|
||||||
aligncount:=(PtrUInt(pdest) and (sizeof(PtrUInt)-1)) shr 1;
|
aligncount:=(PtrUInt(pdest) and (sizeof(PtrUInt)-1)) shr 1;
|
||||||
dec(count,aligncount);
|
dec(count,aligncount);
|
||||||
@ -221,7 +227,7 @@ procedure filldword(var x;count : SizeInt;value : dword);
|
|||||||
var
|
var
|
||||||
aligncount : sizeint;
|
aligncount : sizeint;
|
||||||
pdest,pend : pdword;
|
pdest,pend : pdword;
|
||||||
v : ptruint;
|
v : ALUUInt;
|
||||||
begin
|
begin
|
||||||
if count <= 0 then
|
if count <= 0 then
|
||||||
exit;
|
exit;
|
||||||
@ -229,9 +235,9 @@ begin
|
|||||||
if Count>4*sizeof(ptruint)-1 then
|
if Count>4*sizeof(ptruint)-1 then
|
||||||
begin
|
begin
|
||||||
v:=value;
|
v:=value;
|
||||||
{$ifdef CPU64}
|
{$if sizeof(v)=8}
|
||||||
v:=(v shl 32) or v;
|
v:=(v shl 32) or v;
|
||||||
{$endif CPU64}
|
{$endif sizeof(v)=8}
|
||||||
{ Align on native pointer size }
|
{ Align on native pointer size }
|
||||||
aligncount:=(PtrUInt(pdest) and (sizeof(PtrUInt)-1)) shr 2;
|
aligncount:=(PtrUInt(pdest) and (sizeof(PtrUInt)-1)) shr 2;
|
||||||
dec(count,aligncount);
|
dec(count,aligncount);
|
||||||
|
Loading…
Reference in New Issue
Block a user