Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64326 - in sandbox/SOC/2010/bit_masks: . boost/bitfield boost/integer/detail/bft lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-07-25 10:16:45


Author: bbartman
Date: 2010-07-25 10:16:42 EDT (Sun, 25 Jul 2010)
New Revision: 64326
URL: http://svn.boost.org/trac/boost/changeset/64326

Log:
fixing minor warnings comming from not correctly constructing one of the integral constants before shifting its value, and prerping tests for creation of custom member
Added:
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/custom_packing_policy.hpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield_orignal.hpp | 4
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp | 83 +++++++++++++++++++--------------------
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/custom_member_test.cpp | 6 ++
   sandbox/SOC/2010/bit_masks/notes.txt | 13 +----
   4 files changed, 51 insertions(+), 55 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield_orignal.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield_orignal.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield_orignal.hpp 2010-07-25 10:16:42 EDT (Sun, 25 Jul 2010)
@@ -191,8 +191,8 @@
         static const std::size_t STS = 8 * sizeof(storage_type);
         static const std::size_t LASTD = STS-LAST-1;
         static const std::size_t WIDTH = LAST - FIRST + 1; //!< Width in bits of the bitfield
- static const storage_type VAL_MASK = (1 << WIDTH) - 1; //!< Mask applied against assigned values
- static const storage_type FIELD_MASK = (VAL_MASK << LASTD); //!< Mask of the field's bit positions
+ static const storage_type VAL_MASK = (STORAGE_TYPE(1) << WIDTH) - 1; //!< Mask applied against assigned values
+ static const storage_type FIELD_MASK = (STORAGE_TYPE(VAL_MASK) << LASTD); //!< Mask of the field's bit positions
         static const storage_type SIGN_MASK = ~VAL_MASK; //!< Sign mask applied against assigned values
 
 

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp 2010-07-25 10:16:42 EDT (Sun, 25 Jul 2010)
@@ -312,29 +312,52 @@
             typename Offset
>
 struct bft_arg_parse_impl <
- bitfields::custom<ReturnType,Name,Mask,Policy>,
+ bitfields::custom<
+ ReturnType,
+ Name,
+ Mask,
+ Policy
+ >,
     StoragePolicy,
     FieldVector,
     Offset >
 {
- /*
- TODO: This needs to be better defined!
- typedef bitfields::custom<ReturnType,Name,Mask,Policy> param;
+ // PRECONDITION: Value bits of the mask Can't be 0.
+ BOOST_STATIC_ASSERT(( Mask::value != 0 ));
+
+ typedef typename pointer_member::count_leading_zeros<
+ Mask
+ >::type front_storage_space;
+
+ typedef typename pointer_member::count_trailing_zeros<
+ Mask
+ >::type back_storage_space;
+
+ typedef typename mpl::minus<
+ mpl::size_t< bit_width< void* >::value>,
+ typename mpl::plus<
+ front_storage_space,
+ back_storage_space
+ >::type
+ >::type size_of_storage;
+
+
+ typedef typename mpl::plus< Offset, size_of_storage>::type offset;
+
+ typedef bitfields::custom< ReturnType, Name, Mask, Policy > param;
+
+ typedef StoragePolicy storage_policy;
     typedef typename mpl::push_back<
         FieldVector,
         bitfield_element<
- ReturnType,
- NameType,
+ ReturnType*,
+ Name,
             Offset,
- mpl::size_t<FieldWidth>
+ size_of_storage,
+ Mask,
+ Policy
>
- >::type field_vector;
-
- typedef StoragePolicy storage_policy;
-
-
-
- // typedef offset;
+ >::type field_vector;
 
     typedef bft_arg_parse_impl<param,storage_policy,field_vector,offset> type;
 
@@ -346,8 +369,7 @@
             field_vector,
             offset
> type;
- };
- */
+ };
 };
 
 
@@ -365,33 +387,8 @@
     FieldVector,
     Offset >
 {
- /** What must be calculated writen out so I can see it better.
- *
- * 1.) Make sure that the mask for the pointer isn't 0.
- * A.) if it is that means that NOTHING is being stored in the pointer
- * and everything else can be ignroed (Not sure if this should be a
- * PRECONDITION that causes a static_assertion or not).
- * B.) Make sure the mask is the same size as a pointer.
- * If it is NOT the same size as a pointer, then cause a static
- * assertion.
- *
- * 2.) Determin the offset into the mask.
- * A.) What is mean by this is that I need know which bits wihtin the
- * mask that have value are respected as such and the ones which don't
- * are able to be used for extra storage.
- * B.) Summary: Look for leading zeros and look for trailing zeros.
- * Those are the places which values can be stored within.
- * C.) PRECONDITION: The offset must be less then or equal to the number
- * of leading 0's within the value of the pointer.
- * D.) Behavior in the case that there are leading zeros wihtin the
- * mask and the offset is not the same as the amound of leading zeros
- * within the mask. The zeros are treated as filler and the pointer is
- * always stored relative to the mask provided.
- *
- *
- * 3.) The offset of the storage location of the pointer shall be relative
- * to the first 1 within the mask provided.
- */
+ // PRECONDITION: Value bits of the mask Can't be 0.
+ BOOST_STATIC_ASSERT(( Mask::value != 0 ));
 
     // PRECONDTION: type of mask::value_type must be the same size as a pointer.
     BOOST_STATIC_ASSERT(( sizeof(typename Mask::value_type) == sizeof(void*) ));

Added: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/custom_packing_policy.hpp
==============================================================================

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/custom_member_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/custom_member_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/custom_member_test.cpp 2010-07-25 10:16:42 EDT (Sun, 25 Jul 2010)
@@ -7,6 +7,12 @@
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/type_traits/is_same.hpp>
 
+using namespace boost;
+using namespace boost::bitfields;
+
+struct cust;
+
+
 int main() {
     return 0;
 }

Modified: sandbox/SOC/2010/bit_masks/notes.txt
==============================================================================
--- sandbox/SOC/2010/bit_masks/notes.txt (original)
+++ sandbox/SOC/2010/bit_masks/notes.txt 2010-07-25 10:16:42 EDT (Sun, 25 Jul 2010)
@@ -20,11 +20,6 @@
 
 
 5) pointer_packing_policy.hpp
-
- c) Finish the pointer specialization so that fewer specialization are
- needed there should be aligned and unaligned and that really should
- be all. Unless there there is some issue.
-
 6) name_lookup.hpp
 7) make_bitfield_tuple.hpp
 8) bitfield_tuple_impl.hpp
@@ -39,10 +34,6 @@
         I ) This could be more of a pain, however it seems quite simple
                 after implementing the pointer stuff.
 
- c) Add compile-failure test for the mask type not being the same size as
- a pointer.
-
-
 12) bitfield_iterator.hpp - Fusion Extension
     A) Add OR remove const functions. Fusion may be a non const only
         thing. Other option is to make a const iterator but that could be more
@@ -165,6 +156,8 @@
 1) !DONE! Add interface test for the interface macros. !DONE!
 2) interface meta-function test suite.
 3) Create additional tests for count leading and trailing zero meta-functions.
+4) Create Compile failure test for pointer member mask being 0.
+5) Create compile Failure test for custom member mask being 0.
 
 --------------------------------------------------------------------------------
 
@@ -189,7 +182,7 @@
    struct get_proxy_reference_type_by_index;
 
 no particular file yet.
-6) How to make your own custom policy (After I finish the pointer stuff)
+6) How to make your own custom policy (After I finish the pointer/custom stuff)
 
 
 General Topic


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