← Back to Games

⬇️ Bit Shutdown Panel

Turn OFF the ith bit - power down with AND and NOT!

🔌 Shutdown Control
n & ~(1 << i) → Turn OFF bit i
Original Number (n) 0
Mask ~(1 << i) 0
Result (n & mask) 0

📚 Turn OFF the ith Bit

To turn OFF (set to 0) the ith bit of a number, use AND with an inverted mask:

result = n & ~(1 << i)

// Example: Turn off bit 3 of 255
// 255 = 11111111
// 1 << 3 = 00001000
// ~(1 << 3) = 11110111
// AND -----------
// 247 = 11110111

The inverted mask ~(1 << i) has all bits 1 except bit i. ANDing with this mask forces bit i to 0, leaving other bits unchanged.