??? 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; |
Topic | Author | Date |
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 |