Last active
August 29, 2015 14:20
-
-
Save adohe-zz/15ee96b5dc91b8414dbd to your computer and use it in GitHub Desktop.
shift operation.
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
在c 中左移也就是所说的逻辑移位,右端补0,而右移是算数移位,左端补齐的是最高位的符号位。 | |
故负数左移,有可能变成正数,但负数右移,肯定还是负数。 | |
用16进制的形式对数据进行赋值,这16进制的数代表的是补码。 | |
对于signed类型的扩展,看该数据的最高位,为1,则扩展的所有位都为1,为0,则扩展的位都为0,故0xf7扩展成32位是0xfffffff7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment