【发布时间】:2017-06-14 18:04:57
【问题描述】:
我知道一些可变长度的数字编码 其核心思想是 1 对有效载荷长度进行线性编码。
0
10x
110xx
1110xxx
或 1 和 X 交错:
0
1x0
1x1x0
1x1x1x0
经过一些小的修改(每个 1 有 7 个 X,最后有 7 个 X),我们得到:
0xxxxxxx
1xxxxxxx0xxxxxxx
1xxxxxxx1xxxxxxx0xxxxxxx
1xxxxxxx1xxxxxxx1xxxxxxx0xxxxxxx
https://en.wikipedia.org/wiki/Variable-length_quantity
或:
0xxxxxxx
110xxxxx 10xxxxxx
1110xxxx 10xxxxxx 10xxxxxx
11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
https://de.wikipedia.org/wiki/UTF-8
但它们都是线性缩放的。 我想要一些能成倍增长的东西 可以正向按位解码 (无需字节对齐、反向解码或随机搜索) 所以我想出了:
0
1x0
1x1xx0
1x1xx1xxxx0
1x1xx1xxxx1xxxxxxxx0
有没有人知道这是一个东西,它叫什么?
【问题讨论】: