CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: math logic confusion

    Quote 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
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  2. #17
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: math logic confusion

    Quote Originally Posted by GCDEF View Post
    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

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured