【发布时间】:2015-11-07 18:09:24
【问题描述】:
我正在使用以下函数来交换(未)有符号的 64 位整数值:
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指令。