Bart schrieb:
Did you also test the simpler approach, replicating the pattern in one
loop? It's independent of endianness, and can boil down to a single
machine instruction (x86: REP MOVS).
It would be repeating either 2,3, or 4-bytes each time.
How would you code that?
I would not care.
function Utf8StringOfChar(AUtf8Char: Utf8String; N: Integer): Utf8String;
var
UCharLen, i,nb: Integer;
PC: PChar;
begin
Result := '';
UCharLen := Length(AUtf8Char);
nb := N*UCharLen;
if nb <= 0 then exit;
//3:
Result := AUtf8Char;
SetLength(Result, nb);
PC := Result;
for i:=1 to nb-UCharLen do
begin
PC[UCharLen] := PC[0] inc(PC);
end;
end;
DoDi
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus