I have been trying to write a function that takes two pointers (an input and an output) and writes the bytes from the input into the output in reverse order. So far I have
procedure ReverseBytes(Source, Dest: Pointer; Size: Integer); begin Dest := PByte( NativeUInt(Dest) + Size - 1); while (Size > 0) do begin PByte(Dest)^ := PByte(Source)^; Inc(PByte(Source)); Dec(PByte(Dest)); Dec(Size); end; end;