Solved

Combine bits value

Posted on 2004-03-28
2
181 Views
Last Modified: 2006-11-17
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.
0
Comment
Question by:MyQ2004
2 Comments
 
LVL 10

Accepted Solution

by:
ptmcomp earned 50 total points
ID: 10699056
result = 0x1234 | (0x12 << 16);  // shift left by 16 binary digits then combine with the lower 16 bits
0
 
LVL 10

Assisted Solution

by:smegghead
smegghead earned 50 total points
ID: 10700329
or you could just multiply the 16-23 by 65536 and add the 0-15 bits

i.e.

(high*65536)+low

smg.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question