我完全不明白这段代码在做什么,有人可以解释一下吗?
long input; //just here to show the type, assume it has a value stored
unsigned int output( input >> 4 & 0x0F );
谢谢
最佳答案
将输入向右移动 4 位,然后用低 4 位屏蔽。
以16位数字为例:(点只是为了视觉分隔)
1001.1111.1101.1001 >> 4 = 0000.1001.1111.1101
0000.1001.1111.1101 & 0x0F = 1101 (or 0000.0000.0000.1101 to be more explicit)
关于c++ - 这是在做什么 : "input >> 4 & 0x0F"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12515412/