Skip to content

Commit 317adc7

Browse files
author
liwentian
committed
fd
1 parent a95a05f commit 317adc7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎doc/BitSet.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Check if the integer is even or odd
1+
#### **Check if the integer is even or odd**
22
```
33
if ((x & 1) == 0) {
44
x is even
@@ -8,7 +8,7 @@ if ((x & 1) == 0) {
88
```
99
<br/>
1010

11-
Test if the n-th bit is set
11+
#### **Test if the n-th bit is set**
1212
```
1313
if (x & (1 << n)) {
1414
n-th bit is set
@@ -18,19 +18,19 @@ if (x & (1 << n)) {
1818
```
1919
<br/>
2020

21-
Set the n-th bit
21+
#### **Set the n-th bit**
2222
```
2323
y = x | (1 << n)
2424
```
2525
<br/>
2626

27-
Unset the n-th bit
27+
#### **Unset the n-th bit**
2828
```
2929
y = x & ~(1 << n)
3030
```
3131
<br/>
3232

33-
Toggle the n-th bit
33+
#### **Toggle the n-th bit**
3434
```
3535
y = x ^ (1 << n)
3636
```

0 commit comments

Comments
 (0)