What is uint_fast32_t and why should it be used instead of the regular int and uint32_t?

前端 未结 4 1747
孤城傲影
孤城傲影 2020-12-04 09:58

So the reason for typedef:ed primitive data types is to abstract the low-level representation and make it easier to comprehend (uint64_t instead of

4条回答
  •  遥遥无期
    2020-12-04 10:34

    Note that the fast version could be larger than 32 bits. While the fast int will fit nicely in a register and be aligned and the like: but, it will use more memory. If you have large arrays of these your program will be slower due to more memory cache hits and bandwidth.

    I don't think modern CPUS will benefit from fast_int32, since generally the sign extending of 32 to 64 bit can happen during the load instruction and the idea that there is a 'native' integer format that is faster is old fashioned.

提交回复
热议问题