从2个字节读取14位数字

2024-06-16 09:29:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试解码本规范appendices/Edms_VirtualBlockInfo.htm" rel="nofollow">here中描述的游程编码。 上面写着:

There may be 1, 2, 3, or 4 bytes per count. The first two bits of the first count byte contains 0,1,2,3 indicating that the count is contained in 1, 2,3, or 4 bytes. Then the rest of the byte (6 bits) represent the six most significant bytes of the count. The next byte, if present, represents decreasing significance

我已经成功地读取了长度的前2位,但无法找出如何将值编码到下一个14位。在

我是这样得到长度的:

^{1}$

看来数据是大端的。我试过换位元,拆开包装,用不同的尾数重新包装,我无法得到我期望的数字。在


Tags: orofthe规范编码bytescountbyte