Hello Rob,

RK> procedure SwapCardinal(var X: Cardinal);
RK> asm
RK>   mov ecx, [eax]
RK>   bswap ecx
RK>   mov [eax], ecx
RK> end;

RK> The BSWAP instruction reverses the order of the bytes in a register. It's
RK> safe to overwrite ECX without saving its previous value. The parameter
RK> gets passed in EAX.

or make it a function that returns the swapped bytes:

function SwapCardinal(X: cardinal): cardinal;
asm
   bswap eax
end;

---
Rgds, Wilfried
http://www.mestdagh.biz

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to