Pavan Chandaka
Pavan Chandaka

Reputation: 12781

Why INT_FAST16_MAX is defined as INT32_MAX (VS 2015)?

I opened "stdint.h" file from visual studio 2015 and as shown in below image, I noticed the INT_FAST16_MAX is defined to INT32_MAX. And same with unsigned too. Why is it so?

enter image description here

But the least ones are defined as expected. (below)

#define INT_LEAST16_MAX  INT16_MAX
#define UINT_LEAST16_MAX UINT16_MAX

Upvotes: 2

Views: 550

Answers (1)

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137467

INT_FAST16_MAX is the largest value that can be stored in an int_fast16_t variable.

int_fast16_t is guaranteed to be the fastest int with a size of at least 16 bits.

Because MSVC is targeting machines that have 32-bit general purpose registers which are faster to access than 16-bit, int_fast16_t is actually a 32-bit integer. And thus, INT_FAST16_MAX is INT32_MAX.

See also:

Upvotes: 8

Related Questions