?
Solved

Combine bits value

Posted on 2004-03-28
2
Medium Priority
?
185 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 200 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 200 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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

764 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