Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63353 - in sandbox/SOC/2010/bit_masks/boost/integer: . details details/bft
From: bbartmanboost_at_[hidden]
Date: 2010-06-26 11:48:03


Author: bbartman
Date: 2010-06-26 11:48:00 EDT (Sat, 26 Jun 2010)
New Revision: 63353
URL: http://svn.boost.org/trac/boost/changeset/63353

Log:
implemented a mechanism for deducing the storage type of a btifield_tuple based on the parameters supplied to by the user
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp | 2 --
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/deduce_storage.hpp | 28 ++++++++++++++++++++++++++--
   sandbox/SOC/2010/bit_masks/boost/integer/details/bitfield_tuple_impl.hpp | 1 +
   3 files changed, 27 insertions(+), 4 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp 2010-06-26 11:48:00 EDT (Sat, 26 Jun 2010)
@@ -494,8 +494,6 @@
     storage_type _data;
 };
 
-
-
 } // end boost
 
 

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/deduce_storage.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/deduce_storage.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/deduce_storage.hpp 2010-06-26 11:48:00 EDT (Sat, 26 Jun 2010)
@@ -3,17 +3,41 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_BITFIELD_TUPLE_DEDUCED_STORAGE_HPP
-#define BOOST_BITFIELD_TUPLE_DEDUCED_STORAGE_HPP
+#ifndef BOOST_BITFIELD_TUPLE_DEDUCE_STORAGE_HPP
+#define BOOST_BITFIELD_TUPLE_DEDUCE_STORAGE_HPP
 
 #include <boost/cstdint.hpp>
+#include <boost/mpl/less_equal.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/config.hpp>
 
 namespace boost { namespace details {
 
 /** Meta functions used for deducing the type of storage that should be used if
  * the user doesn't supply a storage type to a bitfield_tuple.
  */
+template <typename BitsUsed>
+struct deduce_storage_type {
 
+ BOOST_STATIC_ASSERT(( BitsUsed::value <= 64));
+ typedef typename mpl::if_<
+ mpl::less_equal< BitsUsed, mpl::size_t<8> >,
+ uint_least8_t,
+ typename mpl::if_<
+ mpl::less_equal< BitsUsed, mpl::size_t<16> >,
+ uint_least16_t,
+ #ifndef BOOST_NO_INT64_T
+ typename mpl::if_<
+ mpl::less_equal< BitsUsed, mpl::size_t<32> >,
+ uint_least32_t,
+ uint_least64_t
+ >::type
+ #else
+ uint_least32_t
+ #endif
+ >::type
+ >::type type;
+};
 
 }} // end boost::details
 

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bitfield_tuple_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bitfield_tuple_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bitfield_tuple_impl.hpp 2010-06-26 11:48:00 EDT (Sat, 26 Jun 2010)
@@ -21,6 +21,7 @@
 // implementation header files.
 #include <boost/integer/details/bft/bft_element.hpp>
 #include <boost/integer/details/bft/arg_parse_impl.hpp>
+#include <boost/integer/details/bft/deduce_storage.hpp>
 
 namespace boost { namespace details {
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk