Einzelnen Beitrag anzeigen

Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#3

AW: int32_t , int16_t in Delphi, Function nach Delphi übersetzen

  Alt 15. Nov 2016, 22:45
Ich glaube, man könnte es so übersetzen:

Delphi-Quellcode:
function gds(i: LongInt): LongInt; inline;
var
  d: array[0..3] of Byte absolute i;
  x: Byte;
begin
// ......
// swap required
  x := d[0]; d[0] := d[3]; d[3] := x;
  x := d[1]; d[1] := d[2]; d[2] := x;

// ......
// other action
  i := (Int32(d[0]) shl 24) or (Int32(d[1]) shl 16) or (Int32(d[2]) shl 8) or (Int32(d[3]));
{$endif}
end;
Ungetestet.
  Mit Zitat antworten Zitat