字节数组倒序

procedure SwapBytesArr(var BytesArr:array of Byte);
var i,h:Integer;
begin
  h:=High(BytesArr);
  if h=1 then Exit;
  for i:=0 to (h div 2)-1 do
  begin
    BytesArr[i]  :=BytesArr[i] xor BytesArr[h-i];
    BytesArr[h-i]:=BytesArr[i] xor BytesArr[h-i];
    BytesArr[i]  :=BytesArr[i] xor BytesArr[h-i];
  end;
end;

猜你喜欢

转载自www.cnblogs.com/zyb2016/p/13389405.html