[Lazarus] Optimize SwapEndian for widestring?

Alexey aaa5500 at ya.ru
Wed Aug 2 10:22:28 CEST 2017


Thanks, it didn't compile, this this did:

function SSwapEndian(const S: UnicodeString): UnicodeString;
var
   i: integer;
   p: PWord;
begin
   Result:= S;
   if S='' then exit;
   UniqueString(Result);
   P:= PWord(@Result[1]);
   for i:= 1 to Length(Result) do
   begin
     P^:= SwapEndian(P^);
     Inc(P);
   end;
end;

AlexeyT


More information about the Lazarus mailing list