Solved

Combine bits value

Posted on 2004-03-28
2
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 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