GIF 规范无符号定义

发布于 2024-12-03 05:50:04 字数 256 浏览 1 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

起风了 2024-12-10 05:50:04

规范中的“无符号”指的是 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 for unsigned int, and at the time the GIF specification was written, it was probably reasonable to assume that int on most machines was 16 bits, so it's not entirely unreasonable for them to not define the terms they were using.

裂开嘴轻声笑有多痛 2024-12-10 05:50:04

无论文档中提到“无符号”一词,相邻的图表都会显示它所占用的字节数。看起来总是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:

Byte Ordering - Unless otherwise stated, multi-byte numeric fields are
ordered with the Least Significant Byte first.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文