1
0

Theme update. Work on bitmagic post
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-07-05 11:14:47 +02:00
parent 25afb5e4e0
commit 6f8f5bfe06
2 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,8 @@ projects: []
output = input | (1 << bit); output = input | (1 << bit);
// Shorthand // Shorthand
variable |= (1 << bit); variable |= (1 << bit);
// Multiple bits
variable |= (0b101 << bit);
``` ```
# Clear a bit # Clear a bit
@ -42,6 +44,9 @@ variable |= (1 << bit);
output = input & ~(1 << bit); output = input & ~(1 << bit);
// Shorthand // Shorthand
variable &= ~(1 << bit); variable &= ~(1 << bit);
// Multiple bits
variable &= ~(0b101 << bit);
``` ```
# Toggle a bit # Toggle a bit
@ -50,4 +55,6 @@ variable &= ~(1 << bit);
output = x ^ (1 << bit); output = x ^ (1 << bit);
// Shorthand // Shorthand
variable ^= (1 << bit); variable ^= (1 << bit);
// Multiple bits
variable ^= (0b101 << bit);
``` ```