Combine bits value

i have two hex numbers :

0x1234 represents the low 16 bits value of milleage covered by a plane.
0x12    represent bits 16-23 of the milleage covered by a plane.

Given the above values, how do I combine both to give the actual value of milleage covered by the plane ? It should be signed value.
MyQ2004Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ptmcompConnect With a Mentor Commented:
result = 0x1234 | (0x12 << 16);  // shift left by 16 binary digits then combine with the lower 16 bits
0
 
smeggheadConnect With a Mentor Commented:
or you could just multiply the 16-23 by 65536 and add the 0-15 bits

i.e.

(high*65536)+low

smg.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.