
Originally Posted by
Sarevok
kay bored ko, ako ning buhion balik
[Programming Language]
C/C++ (I think applicable sa tanan)
[Question]
Recently naay programming question na nisikat sa interwebs which is this:
If x is an (binary) integer, what does (x & -x) compute?
x & -x returns 1 if bot bits are 1. else 0.
for example:
x = 15;
y = 9;
z = x & y;
x = 1111
y = 1001
-------------
z = 1001
so x & y yields 9 of decimal 1001.
& is bitwise operator.