ELCouz
ELCouz

Reputation: 572

Join 16-bit integer to make a 32-bit in Delphi?

I would like to know what is the equivalent to Make32 function in Delphi?

See the attached image...


enter image description here

Upvotes: 0

Views: 569

Answers (2)

David Heffernan
David Heffernan

Reputation: 613322

I know three commonly used approaches.

Bitwise operations

u32 := (u16hi shl 16) or u16lo;

MAKELONG

u32 := MAKELONG(u16lo, u16hi);

LongRec cast

LongRec(u32).Hi := u16Hi;
LongRec(u32).Lo := u16Lo;

Upvotes: 7

Sertac Akyuz
Sertac Akyuz

Reputation: 54812

You can use MakeLong for two Words, and MakeWord for two bytes.

Upvotes: 6

Related Questions