Your question is not clear.
If you just want to reset bit 0, here are a few methods (with slight variations depending on your types):
x &= -2; x &= ~1; x -= (x&1);
If you want to undo the least significant bit among the bits that are set, here are a few ways:
x &= x-1; x -= (x&-x);
Note that x&-x is the least significant bit of x , at least when x is unsigned or two-component. If you want to do any bit arithmetic like this, you should only use unsigned types, since signed types have behavior defined by the implementation of bitwise operations.
R ..
source share