| |

VerySource

 Forgot password?
 Register
Search
Author: memobbq

Byte storage order of longword in delphi

[Copy link]

2

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-6-6 10:15:01
| Show all posts
Thank you very much for the helpful help ofxclzc17(). Although it didn't help me solve the problem, I really appreciate it!!

It has been 3 years since I transferred to Delphi. In general, most programmers in Delphi are indifferent. Asking questions in the delphi group is uninterested, and asking questions in the basic class of verysource is also pitiful.

In order to vent my dissatisfaction, I still can't help but scold, and fuck the basic class of verysource's delphi!! Two bamboo bamboo dick changed!!

There is no way to write a function myself, can't wait any longer...
procedure TLT.Z_SerialLongWord(iValue:LongWord;SerialBuf:Pointer); //Serialize the longword of Delphi into the buffer according to the right alignment $1=00 00 00 01 instead of 01 00 00 00 (delphi default)
var
  desBuf:Array[0..3] of byte;
  tmpBuf:Array[0..3] of byte;
begin
  zeromemory(@desBuf,sizeof(tmpBuf));
  zeromemory(@tmpBuf,sizeof(tmpBuf));

  copymemory(@desBuf,@iValue,sizeof(iValue));
  tmpBuf[0]:=desBuf[3];
  tmpBuf[1]:=desBuf[2];
  tmpBuf[2]:=desBuf[1];
  tmpBuf[3]:=desBuf[0];

  copymemory(@desBuf,@tmpBuf,sizeof(tmpBuf));
  copymemory(SerialBuf,@desBuf,sizeof(desBuf));
end;

  //3037142018=$b5071c02 stored in the buffer: b5071c02 instead of 02 1c 07 b5
  {//Call example:
  var
    iSourceNode:Longword;
    tmpBuf:Array[0..3] of Byte;
  begin
    iSourceNode:=$b5071c02;
    Lt.Z_SerialLongWord(iSourceNode,@tmpBuf);
  end;
  }
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list