msinttypes icon indicating copy to clipboard operation
msinttypes copied to clipboard

fast types should match native word size

Open GoogleCodeExporter opened this issue 10 years ago • 1 comments

I think "fast" types are supposed to allow fast operations (basically, 
efficiently use the registers) on the target machines.

Example: int_fast16_t is currently defined as 16-bit integer, which is slow 
on modern machines. It should definitely map to the same type as 
int_fast32_t.

My gut feeling is that even int_fast32_t should map to a 64-bit integer on a 
64-bit platform (gcc/glibc do that, for example), but Visual Studio 10 
headers define that as "int" (which, if I recall correctly, is 32-bit long on 
Windows).

Original issue reported on code.google.com by [email protected] on 11 Mar 2010 at 6:43

GoogleCodeExporter avatar Mar 14 '15 11:03 GoogleCodeExporter

I do not know for IA64, but for AMD64 (x64), due to the way the CPU is 
organized, 32-bit arithmetic is never slower than 64-bit (they are the same 
instructions internally, and the 64-bit one are extensions thus requiring more 
decoding, not less.)

On the other hand, 32-bit integers would use less memory and need less code 
space for "REX.W" prefixes or for negative constants, so the overall cache 
efficiency would be likely better.

Original comment by [email protected] on 31 Dec 2014 at 4:56

GoogleCodeExporter avatar Mar 14 '15 11:03 GoogleCodeExporter