GIF 规范无符号定义
在 GIF 规范中,此处:
http://www.w3.org/Graphics/ GIF/spec-gif89a.txt
它指的是“字节”,我自然认为它是无符号字符。如果是这种情况,那么“未签名”指的是什么?未签名...什么?精确的定义很重要,因为它让我知道要读入多少字节。
感谢您的宝贵时间。
In the GIF specification, here:
http://www.w3.org/Graphics/GIF/spec-gif89a.txt
It refers to 'bytes', which I naturally assume are unsigned chars. If this is the case, what does it refer to when it says 'unsigned'? Unsigned... what? The precise definition is important as it lets me know how many bytes to read in.
Thank you for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
规范中的“无符号”指的是 16 位整数,最低有效字节在前。
可能应该注意的是,在 C 中,
unsigned
本身就是unsigned int
的同义词,并且在编写 GIF 规范时,可以合理地假设:大多数机器上的 int 是 16 位,因此他们不定义他们所使用的术语并非完全不合理。"unsigned" in the specification refers to a 16-bit integer, with the least significant byte first.
It should probably be noted that in C,
unsigned
by itself is a synonym forunsigned int
, and at the time the GIF specification was written, it was probably reasonable to assume thatint
on most machines was 16 bits, so it's not entirely unreasonable for them to not define the terms they were using.无论文档中提到“无符号”一词,相邻的图表都会显示它所占用的字节数。看起来总是2个字节。
另请注意,附录中提到:
Wherever the word "unsigned" is mentioned in the document, the adjacent diagram shows the number of bytes taken by it. Looks like it's always 2 bytes.
Notice also that the appendix mentions: