$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r64658 - in sandbox/SOC/2010/bit_masks: boost/integer/detail/bitfield_vector lib/integer/test lib/integer/test/bitfield_vector_testing
From: bbartmanboost_at_[hidden]
Date: 2010-08-07 08:45:19
Author: bbartman
Date: 2010-08-07 08:45:16 EDT (Sat, 07 Aug 2010)
New Revision: 64658
URL: http://svn.boost.org/trac/boost/changeset/64658
Log:
begining work on proting a runtime algorithm into compile time
Added:
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/mask_creator.hpp   (contents, props changed)
   sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/mask_creator_test.cpp   (contents, props changed)
Text files modified: 
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 |     1 +                                       
   1 files changed, 1 insertions(+), 0 deletions(-)
Added: sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/mask_creator.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/mask_creator.hpp	2010-08-07 08:45:16 EDT (Sat, 07 Aug 2010)
@@ -0,0 +1,72 @@
+//  Copyright 2010 Brian Bartman.
+//  Distributed under the Boost Software License, Version 1.0.
+//  (See accompanying file LICENSE_1_0.txt or copy at 
+//  http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BITFIELD_VECTOR_MASK_CREATOR_HPP
+#define BOOST_BITFIELD_VECTOR_MASK_CREATOR_HPP
+
+#include <boost/mpl/size_t.hpp>
+#include <boost/mpl/arithmetic.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/mpl/set.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/mpl/size_t.hpp>
+#include <boost/mpl/greater.hpp>
+#include <cstddef>
+
+namespace boost { namespace detail {
+
+
+
+/*
+template <std::size_t Width>
+inline std::size_t get_mask_array_size(std::size_t offset) {
+    BOOST_ASSERT(( offset < 8));
+    std::size_t total_bits = Width + offset;
+    std::size_t ret = 0;
+    ret = total_bits / 8;
+    if(total_bits % 8) {
+        ret += 1;
+    }
+    return ret;
+}
+*/
+
+/** This calculates the size of the array needed to hold the entire mask
+ *  based on an Offset and a Width.
+ */
+template <typename Offset, typename Width>
+struct mask_size {
+    BOOST_STATIC_ASSERT( Offset::value < 8 );
+    
+    typedef typename mpl::plus<Offset,Width>::type total_bits;
+    typedef typename mpl::divides<total_bits,mpl::size_t<8> >::type ret;
+    typedef typename mpl::if_<
+        mpl::greater<
+            typename mpl::modulus< total_bits, mpl::size_t<8> >::type,
+            mpl::size_t<0>
+        >,
+        typename mpl::plus<ret, mpl::size_t<1> >::type,
+        ret
+    >::type type;
+};
+
+/*
+template <std::size_t Offset, std::size_t Width>
+struct mask_info {
+    BOOST_STATIC_CONSTANT(std::size_t, offset   = Offset);
+    BOOST_STATIC_CONSTANT(std::size_t, width    = Width );
+    
+};
+*/
+/** This is the main interface class which will be responsible for
+ *  returning a reference to static mask data member which can be used
+ *  by the reference type within bitfield_vector.
+ */
+// template <std::size_t Width>
+
+
+}} // end booss::detail
+#endif
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2	(original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2	2010-08-07 08:45:16 EDT (Sat, 07 Aug 2010)
@@ -75,5 +75,6 @@
         [ run bitfield_vector_testing/bitfield_vector_base_test.cpp ]
         [ run bitfield_vector_testing/proxy_reference_test.cpp ]
         [ run bitfield_vector_testing/member_impl_test.cpp ]
+        [ run bitfield_vector_testing/mask_creator_test.cpp ]
     ;
 
Added: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/mask_creator_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/mask_creator_test.cpp	2010-08-07 08:45:16 EDT (Sat, 07 Aug 2010)
@@ -0,0 +1,33 @@
+//  Copyright 2010 Brian Bartman.
+//  Distributed under the Boost Software License, Version 1.0.
+//  (See accompanying file LICENSE_1_0.txt or copy at 
+//  http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <boost/integer/detail/bitfield_vector/mask_creator.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+using namespace boost::detail;
+int main() {
+    // testing mask size meta function
+    {
+        typedef mask_size<
+            boost::mpl::size_t<0>,
+            boost::mpl::size_t<4>
+        >::type test_1;
+        BOOST_TEST( test_1::value == 1 );
+
+        typedef mask_size<
+            boost::mpl::size_t<6>,
+            boost::mpl::size_t<3>
+        >::type test_2;
+        BOOST_TEST( test_2::value == 2 );
+
+        typedef mask_size<
+            boost::mpl::size_t<0>,
+            boost::mpl::size_t<50>
+        >::type test_3;
+        BOOST_TEST( test_3::value == 7 );
+    }
+    return boost::report_errors();
+}