Boost logo

Boost :

Subject: [boost] [integer] Bug in int_t<65>
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-02-23 17:17:04


Hi,

I was trying to instantiate a boost::int_t<65>::least and I didn't got
an error. Unfortunately the size of the obtained type was 8.

I think that there is an error in the meta-function class as there is a
comparison without and with the sign bit in // **

   template< int Bits > // bits (including sign) required
   struct int_t : public detail::exact_signed_base_helper<Bits>
   {
       typedef typename detail::int_least_helper
<
#ifdef BOOST_HAS_LONG_LONG
           (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT))
+ // **
#else
            1 +
#endif

The same applies to uint_t.

The fix of course consists in checking

           (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
// **

Please could this be fixed in trunk?

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk