Created
July 30, 2018 08:57
-
-
Save a46554/95f018ba5d5fc11127d8904e836be089 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int 8_t b = -10; // b = 0xf6 for 2's complement | |
b = b << 1; // b=0xec | |
b = b >> 1; // Now b = 0x76 and for demical b = 118 unexpect ouput | |
// The correct way to do that operation | |
b = b&0x80 | b>>1;// b = 0xf6 for demical b = 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment