定点处理:uint16_t 和 uint_fast16_t 有什么区别?
我有一个 16 位定点处理器,我想用它进行定点处理。我正在寻找用于无符号 16 位整数的正确数据类型。
我的问题是:uint16_t
和 uint_fast16_t
之间有什么区别? (这些包含在 stdint.h
中。)uint_fast16_t
是否更好,因为它更快?
谢谢!!
I have a 16 bit fixed point processor and I want to do fixed point processing with it. I'm looking for the correct datatype to use for unsigned 16 bit ints..
My question is: what is the difference between a uint16_t
and uint_fast16_t
? (These are included in the stdint.h
.) Is uint_fast16_t
better since it is faster??
Thanks!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
uint16_t
是一个无符号 16 位整数。uint_fast16_t
是最快的可用无符号整数,至少 16 位。uint16_t
is an unsigned 16-bit integer.uint_fast16_t
is the fastest available unsigned integer with at least 16 bits.uint16_t
比uint_fast16_t
和uint_least16_t
限制更多。不仅后两个可能比 16 位宽,它们还可能具有填充位(不考虑该值的位,例如奇偶校验位)。对于有符号类型,这种差异更加明显。这里,精确宽度类型必须使用二进制补码来表示负值。
uint16_t
is more restrictive thanuint_fast16_t
anduint_least16_t
. Not only that the later two may be wider than 16 bits, they may also have padding bits (bits that don't account for the value such as parity bits).This difference is even more pronounced for the signed types. Here the exact width types must use the two's complement to represent negative values.