当前位置:网站首页>intXX_ T and int_ fastXX_ T what is the difference- What is the difference between intXX_ t and int_ fastXX_ t?

intXX_ T and int_ fastXX_ T what is the difference- What is the difference between intXX_ t and int_ fastXX_ t?

2022-06-11 02:59:00 French red wine sweet

problem :

I have recently discovered existence of standard fastest type, mainly int_fast32_t and int_fast64_t . I recently discovered the standard The fastest The existence of types , Mainly int_fast32_t and int_fast64_t .

I was always told that, for normal use on mainstream architecture, one should better use classical int & long which should always fit to the processor default reading capacity and so avoid useless numeric conversions. I'm always told , For normal use on mainstream architectures , Classic int and long , It should always fit the default read capacity of the processor , So as to avoid useless digital conversion .

In the C99 Standard, it says in §7.18.1.3p2 : stay C99 In the standard , It's in §7.18.1.3p2 In the said :

"The typedef name int_fastN_t designates the fastest signed integer type with a width of at least N. The typedef name uint_fastN_t designates the fastest unsigned integer type with a width of at least N."“typedef name int_fastN_t Specify a width of at least N The fastest signed integer type of .typedef name uint_fastN_t Specify a width of at least N The fastest unsigned integer type of .”

And there is also a quote about it in §7.18.1.3p1 : stay §7.18.1.3p1 There are also references to it in :

"The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear grounds for choosing one type over another, it will simply pick some integer type satisfying the signedness and width requirements."“ There is no guarantee that the specified type is the fastest for all purposes ; If the implementation has no clear reason to choose one type over the other , It will only select some integer types that meet the symbol and width requirements .”

It's unclear to me what fastest really means. I don't know One of the fastest What does it really mean .I do not understand when I should use this type and when I should not. I don't know when to use this type , When not to use .

I have googled a little on this and found that some opensourceprojects have changed some of their functions to it, but not all of them. I use Google Search on this point , Found some to open up Source code project Has changed some of their functions , But not everyone .They didn't really explain why they have changed a part, and only a part, of their code to it. They don't really explain why they have changed a part , and It's just Part of the , Their code .

Do you know what are the specific cases/usages when int_fastXX_t are really faster than the classical ones ? You know when int_fastXX_t Really? Faster than the classic / Usage is what Do you ?


Solution :

Reference resources : https://stackoom.com/en/question/cld8
原网站

版权声明
本文为[French red wine sweet]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020559223772.html