|
Boost Users : |
Subject: Re: [Boost-users] [Integer] Is size_t as fast as uint_value_t<SIZE_MAX>::fast?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-08-04 13:14:48
AMDG
On 08/02/2012 03:34 PM, jsnhblck_at_[hidden] wrote:
> =====================================
> #include<boost/integer.hpp>
> #ifndef SIZE_MAX
> #define SIZE_MAX ((size_t)-1)
> #endif
> /*It is the 'fast' size_t (unsigned integer type of the platform) */
> typedef boost::uint_value_t<SIZE_MAX>::fast fsize_t;
>
> =====================================
>
> Would the above code make any difference cross-platform? Is size_t as
> fast (cross-platform) as the above typedef?
>
> I believe that the above code converts whatever size_t is defined as
> into something that is 'fast'- the easiest for the processor to
> manipulate. However, what I don't know is whether size_t is already that.
>
It's highly unlikely that fsize_t is different
from size_t. (It might be a different type
with the same size, but that won't affect
performance).
> Also, I noticed that boost::hash returns 'size_t' so was just wondering
> why. I will be using hashes in different collections so had tried
> (above) to store them using the 'fast' boost::integer form.
>
In Christ,
Steven Watanabe
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