开发者

Fixed point processing: what is the difference between uint16_t and uint_fast16_t?

开发者 https://www.devze.com 2023-02-09 15:57 出处:网络
I have a 16 bit fixe开发者_如何学运维d 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..

I have a 16 bit fixe开发者_如何学运维d 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!!


uint16_t is an unsigned 16-bit integer. uint_fast16_t is the fastest available unsigned integer with at least 16 bits.


uint16_t is more restrictive than uint_fast16_t and uint_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.

0

精彩评论

暂无评论...
验证码 换一张
取 消