-
December 17th, 2008, 10:58 AM
#16
Re: math logic confusion
Originally Posted by GCDEF
I'll take your word for it with that one.
I won't take it at face value though, since I suspect that m_Hours < 12 is a typographical error that should read m_Hours << 12
-
December 17th, 2008, 11:01 AM
#17
Re: math logic confusion
Originally Posted by GCDEF
I'll take your word for it with that one.
It is a very straightforward technique, simular to using a union. Just make sure that each part occupies a range of bits that do not overlap and are in the proper order. It is better than the union technique because it is not dependant on endianness, and shifting is faster than multiplication.
BOTH the multiply and the shift approaches are much more efficient on pipelined processors (such as the PEntium) because they involve fewer conditionals and therefore lest risk of flushing the pipeline.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|