Highest / lowest integer sign
I read about the whole types of fixed-width ( link cpp ) and came types int_fast8_t
, int_fast16_t
, int_fast32_t
and int_least8_t
,
int_least16_t
, int_least32_t
and etc. My questions follow
- What does this mean, for example, when saying
int_fast32_t
: fast signed integer type (at least 32 bits)? Is the more common typeunsigned int
slow? - What does it mean, for example, when saying
int_least32_t
smallest signed integer type? - what are the differences between
int_fast32_t
,int_least32_t
andunsigned int
?
source to share
int_fast32_t means that it is the fastest type at least 32 bits for the processor. For most processors, this is probably a 32 bit int. But imagine a 48-bit processor without a 32-bit add instruction. Storing all 48 bits is faster. int_least32_t is the smallest type for a target that can contain 32 bits. On a hypothetical 48-bit processor, a 32-bit data type could be supported with library support for their implementation. Or int_least32_t could be 48 bits as well. int is usually the fastest integer type for the target, but there is no guarantee as to the number of bits you will get.
source to share