|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62040 - sandbox/SOC/2010/bit_masks/boost/integer/details
From: bbartmanboost_at_[hidden]
Date: 2010-05-16 13:47:33
Author: bbartman
Date: 2010-05-16 13:47:33 EDT (Sun, 16 May 2010)
New Revision: 62040
URL: http://svn.boost.org/trac/boost/changeset/62040
Log:
working on overloads for bit masks need to create look up failure for thing which arn't masks.
Text files modified:
sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_function_support.hpp | 50 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_function_support.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_function_support.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_function_support.hpp 2010-05-16 13:47:33 EDT (Sun, 16 May 2010)
@@ -0,0 +1,50 @@
+// (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, typename Mask>
+inline T operator&(T t, Mask) {
+ return t & Mask::value;
+}
+
+template <typename Mask, typename T>
+inline T operator&(Mask m, T t) {
+ return Mask::value & t;
+}
+
+// Overloads for bitwise or
+template <typename T, typename Mask>
+inline T operator|(T t, Mask) {
+ return t | Mask::value;
+}
+
+template <typename Mask, typename T>
+inline T operator|(Mask, T t) {
+ return Mask::value | t;
+}
+
+// Overloads for bitwise xor
+template <typename T, typename Mask>
+inline T operator^(T t, Mask) {
+ return t ^ Mask::value;
+}
+
+template <typename T, typename Mask>
+inline T operator^(Mask, T t) {
+ return Mask::value ^ t;
+}
+
+} // end of boost namespace.
+
+#endif
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