Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Commit 8f26e81

Browse files
committed
Update ReadMe.
1 parent ef07d87 commit 8f26e81

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

ReadMe (Chinese).md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ LEB128 编码的基本步骤是将一个整数的常规二进制表示以每 7
1515
| ① 转换为二进制表示 | 1001 | 1000 0111 | 0110 0101 | |
1616
| ② 高位补 0 以使总位数为 7 的倍数 | **0** 1001 | 1000 0111 | 0110 0101 | |
1717
| ③ 以 7 位分割 | 010 0110 | 000 1110 | 110 0101 | |
18-
| ④ 高位字节第 8 位上置 0,表示结束字节 | **0**010 0110 | 000 1110 | 110 0101 | |
19-
| ⑤ 剩余字节第 8 位上置 1,表示仍有数据 | 0010 0110 | **1**000 1110 | **1**110 0101 | |
20-
|自低位字节开始保存并传输 | `0x26` | `0x8E` | `0xE5` ||
18+
| ④ 高位字节第 8 位上置 0,表示结束编码 | **0**010 0110 | 000 1110 | 110 0101 | |
19+
| ⑤ 剩余字节第 8 位上置 1,表示继续编码 | 0010 0110 | **1**000 1110 | **1**110 0101 | |
20+
|自低位字节开始保存并传输数据 | `0x26` | `0x8E` | `0xE5` ||
2121

22-
因此,*624485* 的 LEB128 编码字节流为 `E5 8E 26`。基于同样规则,*0* 的 LEB128 编码字节流为空字节 `0x00`
22+
因此,*624485* 的 LEB128 编码字节流为 `E5 8E 26`。基于同样规则,*0* 的 LEB128 编码字节流为空字节 `00`
2323

2424
## 负整数 (Signed LEB128)
2525

@@ -31,12 +31,12 @@ LEB128 编码的基本步骤是将一个整数的常规二进制表示以每 7
3131
| :------------------------------------ | -------------: | ----------------: | ----------------: | ---------: |
3232
| ① 将绝对值 *123456* 转换为二进制 | 1 | 1110 0010 | 0100 0000 | |
3333
| ② 高位补 0 以使总位数为 7 的倍数 | **0** **000**1 | 1110 0010 | 0100 0000 | |
34-
| ③ 取反(求绝对值 1 的补码| **1** **1110** | **0001** **1101** | **1011** **1111** | |
35-
| ④ 加 1(求绝对值 2 的补码| 1 1110 | 0001 1101 | 1**100** **0000** | |
34+
| ③ 取反(求绝对值的 1 补码| **1** **1110** | **0001** **1101** | **1011** **1111** | |
35+
| ④ 加 1(求绝对值的 2 补码| **1** **1110** | **0001** **1101** | **1100** **0000** | |
3636
| ⑤ 以 7 位分割 | 111 1000 | 011 1011 | 100 0000 | |
37-
| ⑥ 高位字节第 8 位上置 0,表示结束字节 | **0**111 1000 | 011 1011 | 100 0000 | |
38-
| ⑦ 剩余字节第 8 位上置 1,表示仍有数据 | **0**111 1000 | **1**011 1011 | **1**100 0000 | |
39-
|自低位字节开始保存并传输 | `0x78` | `0xBB` | `0xC0` ||
37+
| ⑥ 高位字节第 8 位上置 0,表示结束编码 | **0**111 1000 | 011 1011 | 100 0000 | |
38+
| ⑦ 剩余字节第 8 位上置 1,表示继续编码 | 0111 1000 | **1**011 1011 | **1**100 0000 | |
39+
|自低位字节开始保存并传输数据 | `0x78` | `0xBB` | `0xC0` ||
4040

4141
因此,*−123456* 的 LEB128 编码字节流为 `C0 BB 78`
4242

ReadMe.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ Swift doesn’t have a system framework that deals with LEB128 encoding. *LEB128
2525

2626
Swift `Int` and `UInt` values can be extracted from corresponding types. However, when the stored value exceeds platform limitation, properties returning Swift integers become unavailable and debugging prints raw bytes instead of human-readable decimals.
2727

28+
`Signed7BitEncodedInteger` and `Unsigned7BitEncodedInteger` have not yet supported all arithmetic operations. Conformance to `BinaryInteger` is scheduled on is in the works.
29+

0 commit comments

Comments
 (0)