Bitwise operations - very unexpected results on Arduino.


why code have different result when run on arduino, when run on pc?

code: [select]
serial.println((0<<24 | 18<<16 | 176<<8 | 83));


expected result (on pc): 1224787
unexpected result (on arduino): -20397


i tried think of including casing every single value unsigned integers, casting result unsigned integer, using variables , many more things forgot... nothing worked.

so questions are:
why happening?
how can expected result on arduino?

cast them uint32_t.


Arduino Forum > Using Arduino > Programming Questions > Bitwise operations - very unexpected results on Arduino.


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'