$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Niels Dekker - mail address until 2007-11-30  (nd_mail_address_valid_until_2007-11-30_at_[hidden])
Date: 2007-06-05 17:06:58
Hi me22!!!  :-)
Scott McMurray (aka me22) wrote about boost::int_t<Bits>:
> The implementation is quite ingenious, actually.  On a proverbial
> toaster with 42-bit everything, a request for int_t<39>::least would
> give a signed char, the "smallest" type.
I agree about it being quite ingenious.  And I like the fact that it
supports 42-bit-everything-systems.  But still, personally I'd rather
have it support all kinds of 64-bits platforms...
>> Does Boost support ILP64 platforms?  If so, I guess int_t<32>::least
>> should select _int32, instead of int, on such a platform!
>>
> The current implementation deals only in standard C++98 types.
And should it stay that way?
>>> Now I remember someone already already come up with a patch?
> 
> You can still find the patch in the mailing list archives:
> http://listarchives.boost.org/Archives/boost/2006/06/106262.php
I like your int_exact_t<Bits>::exact, Scott!  It could really be of
help, for my own Boost-based project.  Still I don't like the fact that
it will fail to get me a 32-bits integer (_int32) on an ILP64 platform.
Why not having int_exact_t entirely based on the exact-width integer
types from <boost/integer.hpp>?  
Actually I was thinking of a far more simple implementation, as
follows.  (In practice, I find it quite convenient to have the signed
and the unsigned type grouped within one struct.)
  ////////////////////////////////////////////////////////////
    template <unsigned Bits> struct int_exact
    {
    };
    template <> struct int_exact<8>
    {
      typedef int8_t signed_type;
      typedef uint8_t unsigned_type;
    };
    template <> struct int_exact<16>
    {
      typedef int16_t signed_type;
      typedef uint16_t unsigned_type;
    };
    template <> struct int_exact<32>
    {
      typedef int32_t signed_type;
      typedef uint32_t unsigned_type;
    };
  #ifndef BOOST_NO_INT64_T
    template <> struct int_exact<64>
    {
      typedef int64_t signed_type;
      typedef uint64_t unsigned_type;
    };
  #endif
  ////////////////////////////////////////////////////////////
AFAIK, such a template would correctly support any 64-bits platform,
including ILP64.  What do you think?
Anyway, if you would like to add ILP64 support to <boost/integer.hpp> in
a different way, I would appreciate your solution as well...  I just
hope to see it soon, in a Boost release version!  :-)
Kind regards,
  Niels