楼主:
TonyJih (蠕动王)
2011-07-05 09:51:48#include <iostream>
int main()
{
unsigned s=555;
int i=(s>>4) & ~(~0<<3);
std::cout<<i;
system("PAUSE");
return 0;
}
我的算法是这样:
unsigned s=555
也就是说二进制是0000001000101011
右移4bit后=0000000000100010
not 0=1
1左移3bit后=00000000000001000
not运算后 =11111111111110111
再 and 00000000000100010