Solved

Combine bits value

Posted on 2004-03-28
2
176 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now