ITeye博客

c

共 1 篇文章

c语言的移位操作

http://tieba.baidu.com/f?kz=321200798 左移时总是移位和补零。 右移时无符号数是移位和补零,此时称为逻辑右移; 而有符号数大多数情况下是移位和补最左边的位(也就是补最高有效位),移几位就补几位,此时称为算术右移。 #include<iostream> using namespace std; void main() { //unsigned short temp = 0x8151; short temp = 0x8151; cout << temp << endl; printf("%x\n", temp); unsigned char buf[] = {…

2011-08-29 15:51 · c