* alignment handling of generic fillbyte/word fixed

This commit is contained in:
florian 2004-01-31 16:14:24 +00:00
parent 675cc6f20f
commit 87f13990e5

View File

@ -55,12 +55,21 @@ var
begin begin
if count <= 0 then exit; if count <= 0 then exit;
v := 0; v := 0;
v:=(value shl 8) or (value and $FF); { aligned? }
v:=(v shl 16) or (v and $ffff); if (PtrUInt(@x) mod sizeof(PtrUInt))<>0 then
for i:=0 to (count div 4) -1 do begin
longintarray(x)[i]:=v; for i:=0 to count-1 do
for i:=(count div 4)*4 to count-1 do bytearray(x)[i]:=value;
bytearray(x)[i]:=value; end
else
begin
v:=(value shl 8) or (value and $FF);
v:=(v shl 16) or (v and $ffff);
for i:=0 to (count div 4)-1 do
longintarray(x)[i]:=v;
for i:=(count div 4)*4 to count-1 do
bytearray(x)[i]:=value;
end;
end; end;
{$endif FPC_SYSTEM_HAS_FILLCHAR} {$endif FPC_SYSTEM_HAS_FILLCHAR}
@ -82,11 +91,20 @@ var
i,v : longint; i,v : longint;
begin begin
if Count <= 0 then exit; if Count <= 0 then exit;
v:=value*$10000+value; { aligned? }
for i:=0 to (count div 2) -1 do if (PtrUInt(@x) mod sizeof(PtrUInt))<>0 then
longintarray(x)[i]:=v; begin
for i:=(count div 2)*2 to count-1 do for i:=0 to count-1 do
wordarray(x)[i]:=value; wordarray(x)[i]:=value;
end
else
begin
v:=value*$10000+value;
for i:=0 to (count div 2) -1 do
longintarray(x)[i]:=v;
for i:=(count div 2)*2 to count-1 do
wordarray(x)[i]:=value;
end;
end; end;
{$endif not FPC_SYSTEM_HAS_FILLWORD} {$endif not FPC_SYSTEM_HAS_FILLWORD}
@ -1119,8 +1137,8 @@ end;
{ {
$Log$ $Log$
Revision 1.67 2004-01-28 17:02:13 florian Revision 1.68 2004-01-31 16:14:24 florian
* fixed a couple of broken generic routines * alignment handling of generic fillbyte/word fixed
Revision 1.66 2004/01/21 01:25:02 florian Revision 1.66 2004/01/21 01:25:02 florian
* improved generic int. div routines * improved generic int. div routines