int_least64_t vs int_fast64_t vs int64_t

后端 未结 2 1455
青春惊慌失措
青春惊慌失措 2020-12-08 18:50

I\'m trying to port my code to 64bit.

I found that C++ provides 64bit integer types, but I\'m still confused about it.

First, I found four different 64bit

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 19:39

    int64_t has exactly 64 bits. It might not be defined for all platforms.

    int_least64_t is the smallest type with at least 64 bits.

    int_fast64_t is the type that's fastest to process, with at least 64 bits.

    On a 32 or 64-bit processor, they will all be defined, and will all have 64 bits. On a hypothetical 73-bit processor, int64_t won't be defined (since there is no type with exactly 64 bits), and the others will have 73 bits.

提交回复
热议问题