Rip*_*de4 20 c bit-manipulation
我正在编写一个编程项目,我需要做的一件事就是写一个函数,它返回一个掩码,标记最低有效位的位.关于如何使用按位运算符确定位置的任何想法?
ex:
0000 0000 0000 0000 0000 0000 0110 0000 = 96
What can I do with the # 96 to turn it into:
0000 0000 0000 0000 0000 0000 0010 0000 = 32
Run Code Online (Sandbox Code Playgroud)
我一直在靠墙砸了好几个小时试图解决这个问题,任何帮助都会非常感激!
R..*_*R.. 47
x &= -x; /* clears all but the lowest bit of x */
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18039 次 |
| 最近记录: |