Old Person
Old Person

Reputation: 109

Combining two uint32 to ulong64 in c++

I am looking into how to convert two uint32 values to a ulong64 value.

Any help is much appreciated.

Thanks

Upvotes: 0

Views: 954

Answers (1)

Matthew
Matthew

Reputation: 25773

as Mysticial suggests, use a shift.

uint32 a = 0xff00ff00;
uint32 b = 0x00ff00ff;

ulong64 c = ((ulong64)a) << 32 | b; // 0xff00ff0000ff00ff

Upvotes: 3

Related Questions