Use a temporary variable to avoid potential problems of overwriting the argument.

git-svn-id: trunk@33119 -
This commit is contained in:
Jeppe Johansen 2016-02-25 10:38:18 +00:00
parent cc3e09ee46
commit 03d4ada29e

View File

@ -1130,10 +1130,12 @@ end;
generates a perfect 4 cycle code sequence and can be inlined.
}
function SwapEndian(const AValue: LongWord): LongWord;{$ifdef SYSTEMINLINE}inline;{$endif}
var
Temp: LongWord;
begin
Result:= AValue xor rordword(AValue,16);
Result:= Result and $FF00FFFF;
Result:= (Result shr 8) xor rordword(AValue,8);
Temp := AValue xor rordword(AValue,16);
Temp := Temp and $FF00FFFF;
Result:= (Temp shr 8) xor rordword(AValue,8);
end;
function SwapEndian(const AValue: LongInt): LongInt;{$ifdef SYSTEMINLINE}inline;{$endif}