|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62060 - in sandbox/SOC/2010/bit_masks: boost/integer/details lib/integer/test
From: bbartmanboost_at_[hidden]
Date: 2010-05-17 08:48:41
Author: bbartman
Date: 2010-05-17 08:48:41 EDT (Mon, 17 May 2010)
New Revision: 62060
URL: http://svn.boost.org/trac/boost/changeset/62060
Log:
Working on bit_wise operator support
Text files modified:
sandbox/SOC/2010/bit_masks/boost/integer/details/integral_mask_support_functions.hpp | 52 ++++++++++++++++++++++++++++++++++++++++
sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_integral_mask_testing.cpp | 10 +++---
2 files changed, 57 insertions(+), 5 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/integral_mask_support_functions.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/integral_mask_support_functions.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/integral_mask_support_functions.hpp 2010-05-17 08:48:41 EDT (Mon, 17 May 2010)
@@ -0,0 +1,52 @@
+// (C) Copyright Brian Bartman 2010.
+// 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)
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#ifndef BOOST_BIT_MASK_FREE_FUNCTION_SUPPORT_HPP
+#define BOOST_BIT_MASK_FREE_FUNCTION_SUPPORT_HPP
+
+
+
+namespace boost {
+
+// Contains overloads for all of the bit wise operators which apply to bit_masks
+// and applications there of.
+
+// Overloads for bitwise and
+template <typename T, unsigned int Value>
+inline T operator&(T t, integral_mask<T,Value> ) {
+ return t & integral_mask<T,Value>::value;
+}
+
+template <typename T, unsigned int Value>
+inline T operator&(integral_mask<T,Value>, T t) {
+ return integral_mask<T,Value>::value & t;
+}
+
+// Overloads for bitwise or
+template <typename T, unsigned int Value>
+inline T operator|(T t, integral_mask<T,Value>) {
+ return t | integral_mask<T,Value>::value;
+}
+
+template <typename T, unsigned int Value>
+inline T operator|(integral_mask<T,Value>, T t) {
+ return integral_mask<T,Value>::value | t;
+}
+
+// Overloads for bitwise xor
+template <typename T, unsigned int Value>
+inline T operator^(T t, integral_mask<T,Value>) {
+ return t ^ integral_mask<T,Value>::value;
+}
+
+template <typename T, unsigned int Value>
+inline T operator^(integral_mask<T,Value>, T t) {
+ return integral_mask<T,Value>::value ^ t;
+}
+
+} // end of boost namespace.
+
+#endif
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_integral_mask_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_integral_mask_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_integral_mask_testing.cpp 2010-05-17 08:48:41 EDT (Mon, 17 May 2010)
@@ -23,19 +23,19 @@
bit_result = integral_mask<T, 1>() & T(0);
// operator |(T, integral_mask)
- // bit_result = T(0) | bit_mask<T,1>();
+ bit_result = T(0) | integral_mask<T, 1>();
// operator |(integral_mask, T)
- // bit_result = T(0) | integral_mask<T,1>();
+ bit_result = T(0) | integral_mask<T,1>();
// operator |(T, integral_mask)
- // bit_result = integral_mask<T,1>() | T(0);
+ bit_result = integral_mask<T,1>() | T(0);
// operator ^(integral_mask, T)
- // bit_result = T(0) ^ integral_mask<T,1>();
+ bit_result = T(0) ^ integral_mask<T,1>();
// operator ^(T, bit_mask)
- // bit_result = integral_mask<T,1>() ^ T(0);
+ bit_result = integral_mask<T,1>() ^ T(0);
}
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