den-run-ai / msinttypes

Automatically exported from code.google.com/p/msinttypes
0 stars 0 forks source link

fast types should match native word size #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 jacopo.corbetta@gmail.com on 11 Mar 2010 at 6:43

GoogleCodeExporter commented 9 years ago
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 Antoine....@gmail.com on 31 Dec 2014 at 4:56