我使用下面的函數來交換(未)符號的64位整型值:快速Swap64功能在Delphi
function Swap64(I: Int64): Int64;
begin
Int64Rec(Result).Bytes[0] := Int64Rec(I).Bytes[7];
Int64Rec(Result).Bytes[1] := Int64Rec(I).Bytes[6];
Int64Rec(Result).Bytes[2] := Int64Rec(I).Bytes[5];
Int64Rec(Result).Bytes[3] := Int64Rec(I).Bytes[4];
Int64Rec(Result).Bytes[4] := Int64Rec(I).Bytes[3];
Int64Rec(Result).Bytes[5] := Int64Rec(I).Bytes[2];
Int64Rec(Result).Bytes[6] := Int64Rec(I).Bytes[1];
Int64Rec(Result).Bytes[7] := Int64Rec(I).Bytes[0];
end;
我如何做同樣的事情在ASM,使其更快?
無論哪種情況,都可以使用'bswap'指令。 – Jester