Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62224 - sandbox/SOC/2010/bit_masks
From: bbartmanboost_at_[hidden]
Date: 2010-05-25 20:42:55


Author: bbartman
Date: 2010-05-25 20:42:55 EDT (Tue, 25 May 2010)
New Revision: 62224
URL: http://svn.boost.org/trac/boost/changeset/62224

Log:
brainstorming iterfaces
Text files modified:
   sandbox/SOC/2010/bit_masks/notes.txt | 33 ++++++++++++++++++++++++++++++---
   1 files changed, 30 insertions(+), 3 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/notes.txt
==============================================================================
--- sandbox/SOC/2010/bit_masks/notes.txt (original)
+++ sandbox/SOC/2010/bit_masks/notes.txt 2010-05-25 20:42:55 EDT (Tue, 25 May 2010)
@@ -124,7 +124,7 @@
 
 Compile time interface only.
 
-For operations on masks try what Andrew suggested:
+For operations on masks which are compile and runtime try what Andrew suggested:
 Functors for the different operations so the following would work for
 compile time.
 
@@ -140,7 +140,7 @@
 // assuming T is some mask type.
 template <typename T, unsigned int N, bool SetAll = false >
 struct set_bit
- :integral_mask< T::value_type, T::value >// <--- this will do all of the internal
+ :integral_mask< T::value_type, T::value > // <--- this will do all of the internal
     // work as far as keeping types + value etc...
 { };
 
@@ -156,14 +156,41 @@
     :integral_constant< bool, (T::value & (low_bits<T::value_type,1>::value << N) >
 { };
 
-
                     Compile time flip_bit meta-function
+Intent is to specify either a single bit or all bits to be fliped. This meta-function
+will require one specilization as wll for std::numeric_limits<unsigned int>::max.
 
 template <typename T, unsigned int N = std::numeric_limits<unsigned int>::max >
 struct flip_bits
+ :integral_constant<T::value_type, ( ) >
+{ };
+
+
+
+ Compile time clear_bit meta-function
+
+The intent of this function would be for clearing of a single bit or all bits
+from within a mask. This would also require a specilization for
+std::numeric_limits< unsigned int>::max.
+
+
+template <typename T, unsigned int N = std::numeric_limits<unsigned int>::max>
+struct clear_bit
+ :integral_constant<T::value_type,(
+ ( test_bit<T,N>::value ) ?
+ ( T::value ^ ( low_bits<T::value_type,1>::value << N) )
+ :
+ ( test_bit<T,N>::value )
+ ) >
+{ };
+
 
 compile time + runtime interface.
 
+These are functors which provide runtime support for preforming regular masking
+operations with complie time composed masks.
 
 runtime only interface.
 
+
+


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