【发布时间】:2011-06-09 21:23:44
【问题描述】:
可能的重复:
How do you set, clear and toggle a single bit in C?
Removing lowest order bit
n 是一个正整数。它的最右边的设置位如何取消?
说n= 7 => n = 0111。
我想要0110 作为输出。是否有任何简单的按位破解来实现目标?
【问题讨论】:
-
相关,有解释,get & unset。 How to get position of right most set bit in C
标签: c++ c algorithm math bit-manipulation