如果我们有一个十进制值:123 及其二进制版本:01111011
如何从该字节中将最左边的四个和最右边的四个位变为两个独立的int变量?
int
我的意思是:
int a = 7; // 0111 (the first four bits from the left) int b = 11; // 1011 (the first four bits from the right)
非常感激!
c bits bit-manipulation
bit-manipulation ×1
bits ×1
c ×1