On cplusplus.com What I see the data types atomic_int_fastN_t
and atomic_int_leastN_t
where N could be 8,16,32 and 64. So what is the meaning of word least and fast in the them or how they differ? i.e. How atomic_int_fast64_t
is different from at atomic_int_least64_t
and atomic<int64_t>
?
The same principle applies as to the non-atomic typedefs: std::int_least64_t
, std::int_fast32_t
etc.
The "leastn" types are those whose size is at least n bits. It can be more if the implementation does not support a type of exactly n bits.
The "fastn" types are those whose size is at least n bits, and working with them does not require additional operations for the processor (i.e. working with them is fast).
For example, on a 32-bit machine, it's possible that 16-bit integers are supported, but they have to be promoted to 32-bit integers for arithmetic operations, and truncated again once computation is done. On such a machine, std::int_least16_t
would be the 16-bit integer, but std::int_fast16_t
wold be a 32-bit integer, since that's what is fast to work with.
The typedef std::int64_t
is then guaranteed to be exactly 64 bits (and will only exist if such an integer is supported by the implementation).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With