Initialize arrays from strings with a pc_mov operation.
This is smaller and more efficient than the previous code that called memcpy(). It also avoids a theoretical issue if the user's code included an incompatible definition of memcpy.
This commit is contained in:
parent
0c4660d5fc
commit
a7d9d3039b
11
Parser.pas
11
Parser.pas
|
@ -4621,15 +4621,10 @@ var
|
|||
else
|
||||
size := size-1;
|
||||
if size <> 0 then begin
|
||||
GenLdcLong(size);
|
||||
Gen0t(pc_stk, cgULong);
|
||||
GenS(pc_lca, iPtr^.iTree^.token.sval);
|
||||
Gen0t(pc_stk, cgULong);
|
||||
Gen0t(pc_bno, cgULong);
|
||||
LoadAddress;
|
||||
Gen0t(pc_stk, cgULong);
|
||||
Gen0t(pc_bno, cgULong);
|
||||
Gen1tName(pc_cup, 0, cgVoid, @'memcpy');
|
||||
GenS(pc_lca, iPtr^.iTree^.token.sval);
|
||||
Gen2(pc_mov, 0, size);
|
||||
Gen0t(pc_pop, cgULong);
|
||||
if isCompoundLiteral then
|
||||
AddOperation;
|
||||
end; {if}
|
||||
|
|
Loading…
Reference in New Issue