Delphi XE3 -> Integer to array of Bytes

后端 未结 5 1324
野趣味
野趣味 2021-01-02 22:52

I have a data structure:

data = array of integer;

I have filled it from an

source = array of byte;

with

5条回答
  •  独厮守ぢ
    2021-01-02 23:28

    To build this as a function:

    Type TBytes = array of byte;
    
    function InttoBytes(const int: Integer): TBytes;
    begin
      result[0]:= int and $FF;
      result[1]:= (int shr 8) and $FF;
      result[2]:= (int shr 16) and $FF;
    end;
    

提交回复
热议问题