Tags: #stackoverflow #binary #operator
http://stackoverflow.com/questions/40751662/is-a-b-255-255-the-same-as-a-b-255
http://stackoverflow.com/questions/40751662/is-a-b-255-255-the-same-as-a-b-255
Stack Overflow
Is ((a + (b & 255)) & 255) the same as ((a + b) & 255)?
I was browsing some C++ code, and found something like this:
(a + (b & 255)) & 255
The double AND annoyed me, so I thought of:
(a + b) & 255
(a and b are 32-bit unsigned integers)
I
(a + (b & 255)) & 255
The double AND annoyed me, so I thought of:
(a + b) & 255
(a and b are 32-bit unsigned integers)
I