整数的ASN基本编码规则 [英] ASN Basic Encoding Rule of an integer

查看:61
本文介绍了整数的ASN基本编码规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究抽象语法符号1,并阅读 ITU-T X.690建议书.

I'm currently studying the Abstract Syntax Notation One and reading the ITU-T Recommendation X.690.

在第8.3.2段的第15页上,写有:

On page 15 in paragraph 8.3.2, there is written:

如果整数值编码的内容八位位组包含多个八位位组,则第一个八位位组的位和第二个八位位组的位8:

If the contents octets of an integer value encoding consist of more than one octet, then the bits of the first octet and bit 8 of the second octet:

  1. 不应该全部都是一个;和
  2. 不应该全部为零.

注意–这些规则可确保始终以尽可能最小的八位字节数对整数值进行编码.

NOTE – These rules ensure that an integer value is always encoded in the smallest possible number of octets.

我了解到,为了使整数始终以最小的八位字节数进行编码,第一个八位字节不得为零.

I understand that for the integer to be always encoded in the smallest possible number of octet, the first octet shall not be zero.

但是那又如何呢?如果要使用基本编码规则对值65408(1111 1111 1000 0000)进行编码,应该怎么做?

But what about ones? If I want to encode the value 65408 (1111 1111 1000 0000) using the Basic Encoding Rules, how should I do it?

推荐答案

我了解到,为了使整数始终以最小的八位字节数进行编码,第一个八位字节不得为零.

I understand that for the integer to be always encoded in the smallest possible number of octet, the first octet shall not be zero.

不是必需的.如果整数的最高位设置为1,则该值被视为负数(在带符号整数的情况下).为了表示整数正数-添加了零(0)前导八位位组.一般.

Not necessary. If the highest bit of the integer is set to 1, then the value is considered negative (in the case of signed integers). In order to denote the integer positive -- a zero (0) leading octet is added. It is in general.

这是一篇有关整数编码的好文章: http://msdn.microsoft.com/en-us/library/windows/desktop/bb540806(v = vs.85).aspx

Here is a good article about Integer encoding: http://msdn.microsoft.com/en-us/library/windows/desktop/bb540806(v=vs.85).aspx

这篇关于整数的ASN基本编码规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆