you "mask" (using & the "bitwise-and") with a bitvector which is only 0 if and only if you want to turn off.
for more see Mask (computing)DB<22> $in = 0b10101010 + + + DB<23> $mask = 0b11110000 # 1 keep 0 erase + + + DB<24> printf "%b", $in & $mask + 10100000
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: How can I set a bit to 0 ?
by LanX
in thread How can I set a bit to 0 ?
by bartender1382
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |