I don't understand why these are different
this is how I wrote it :
number &= 0 << time;
and this is how it should be written :
number &= ~(1 << time);
Bitwise operations are performed on all bits.
The result of 0 << time
is timeth bit set to zero, and all other bits are zero. So all bits are zero. Bitwise and with zero will always result in zero.
Contrary, the result of 1 << time
is timeth bit set to one, and all other bits are zero. After bitwise negation, the result is timeth bit set to zero, and all other bits are one. Bitwise and will zero out only timeth bit.