Skip to content

Commit 7af93e3

Browse files
committed
fix: typo
1 parent e97a865 commit 7af93e3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/19. 实现 shapeFlags.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,26 @@ console.log(12 | 5); //返回值13
111111

112112
![img](..\images\按位或.gif)
113113

114-
### 2.2 右移操作符
114+
### 2.2 左移操作符
115115

116-
**右移操作符 (`>>`)** 是将一个操作数按指定移动的位数向右移动
116+
**左移操作符 (`<<`)** 是将一个操作数按指定移动的位数向左移动
117117

118118
```ts
119-
1 >> 1 // 0001 -> 0010
119+
1 << 1 // 0001 -> 0010
120120

121-
1 >> 3 // 0001 -> 1000
121+
1 << 3 // 0001 -> 1000
122122
```
123123

124124
### 2.3 实现 v2 版本
125125

126-
通过对于按位与、按位或和右移操作符的理解,我们不难想象,可以将一个 shapeFlag 修改为下面这样:
126+
通过对于按位与、按位或和左移操作符的理解,我们不难想象,可以将一个 shapeFlag 修改为下面这样:
127127

128128
```ts
129129
const ShapeFlags = {
130130
element: 1, // 0001
131-
stateful_component: 1 >> 1, // 0010
132-
text_children: 1 >> 2, // 0100
133-
array_children: 1 >> 3, // 1000
131+
stateful_component: 1 << 1, // 0010
132+
text_children: 1 << 2, // 0100
133+
array_children: 1 << 3, // 1000
134134
}
135135
```
136136

0 commit comments

Comments
 (0)