Wenn die Delphi-Version Inline unterstützt, dann macht Assembler keinen Sinn mehr:
Delphi-Quellcode:
{$IFDEF BIG_ENDIAN}
type
WordBE = Word;
{$ELSE ~BIG_ENDIAN}
function WordBE(AValue: Word): Word; inline;
begin
Result := Swap(AValue);
end;
{$ENDIF BIG_ENDIAN}
procedure TForm20.FormCreate(Sender: TObject);
var
Value: Word;
begin
Value := WordBE($1234); // inlined: mov _x, $3412 !!!
ShowMessage(IntToHex(Value, SizeOf(Value) * 2));
Value := WordBE(Value); // inlined: xchg _l, _h
ShowMessage(IntToHex(Value, SizeOf(Value) * 2));
end;