:
function Flip16(const Value: Word): Word; inline;
begin
Result:= Value xor $8000;
end;
function Flip32(const Value: LongWord): LongWord; inline;
begin
Result:= Value xor $80000000;
end;
function Flip64(const Value: UInt64): UInt64; inline;
begin
Result:= Value xor $8000000000000000;
end;
function SwapBytes(Value: LongWord): Single;
type
Bytes = packed array[0..3] of Byte;
begin
Bytes(Result)[0]:= Bytes(Value)[3];
Bytes(Result)[1]:= Bytes(Value)[2];
Bytes(Result)[2]:= Bytes(Value)[1];
Bytes(Result)[3]:= Bytes(Value)[0];
end;
: , :)
function SwapBytes(Value: LongWord): Single; register;
asm
BSWAP EAX
end;
:
ββSO - .
1) IEEE Big Endian?
, , , - .
2) - , , , , , , .. xor $80;
3) ;
16- Swap - , delphi help , ; XCHG asm, ;
32- Marco;
64- Marco :
function Swap64(Value: UInt64): UInt64;
begin
Result:= Swap32(LongWord(Value));
Result:= (Result shl 32) or Swap32(LongWord(Value shr 32));
end;
4) ?
, .