Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/27/09 11:09
Read: times


 
#171227 - Typecast before the shift.
Responding to: ???'s previous message
You have incorrect code. You have to cast byte4 and byte3 to long before shifting them left. Right now, they are shifting out all bits into thin air. Besides - what is shift 18??? Don't you mean shift 16?

my_long = (((unsigned long)byte4) << 24)
        | (((unsigned long)byte3) << 16)
        | (((unsigned long)byte2) << 8)
        | byte1;


List of 9 messages in thread
TopicAuthorDate
Unsigned Long Roll-over at 65535?            01/01/70 00:00      
   Typecast before the shift.            01/01/70 00:00      
      oh..my mistake.....            01/01/70 00:00      
         Integer promotion            01/01/70 00:00      
            Note on Integer Promotion and Keil            01/01/70 00:00      
               Not much of a choice, really            01/01/70 00:00      
                  Probably            01/01/70 00:00      
                     Design decisions            01/01/70 00:00      
                        Oh yes they can!            01/01/70 00:00      

Back to Subject List