Boost logo

Boost Users :

Subject: [Boost-users] How to find: best integer type for processor
From: Daryle Walker (darylew_at_[hidden])
Date: 2008-10-30 11:24:09


Is there a macro and/or typedef that will tell me bit-length used for
a processor and/or the best integer type for said processor? The
"int" type is supposed to be that type, and it was in the 16- and 32-
bit eras. (I learned C programming with the former in the... early
1990s!) However, the powers-that-be decided, for "backwards
compatibility," to freeze "int" and "long" at 32 bits and use a new
type, "long long," for 64 bits, which should be the optimized integer
type for 64-bit processors. (If they kept to the plan, "int" would
be 64 bits, "long" either 64 or 128, "short" up to 32, and the new
type will be "short short" at 16.) I want to know the best type so,
when I build multi-integer arrays for various purposes, I don't pick
an element type that causes a slow down, whether to focus on a
fraction of a register (if the chosen type is too small) to handle
two registers at once (if the chosen type is too large).

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net