Mercurial > hg > vamp-build-and-test
diff DEPENDENCIES/generic/include/boost/detail/bitmask.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DEPENDENCIES/generic/include/boost/detail/bitmask.hpp Tue Aug 05 11:11:38 2014 +0100 @@ -0,0 +1,47 @@ +// boost/detail/bitmask.hpp ------------------------------------------------// + +// Copyright Beman Dawes 2006 + +// Distributed under the Boost Software License, Version 1.0 +// http://www.boost.org/LICENSE_1_0.txt + +// Usage: enum foo { a=1, b=2, c=4 }; +// BOOST_BITMASK( foo ); +// +// void f( foo arg ); +// ... +// f( a | c ); + +#ifndef BOOST_BITMASK_HPP +#define BOOST_BITMASK_HPP + +#include <boost/cstdint.hpp> + +#define BOOST_BITMASK(Bitmask) \ + \ + inline Bitmask operator| (Bitmask x , Bitmask y ) \ + { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \ + | static_cast<boost::int_least32_t>(y)); } \ + \ + inline Bitmask operator& (Bitmask x , Bitmask y ) \ + { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \ + & static_cast<boost::int_least32_t>(y)); } \ + \ + inline Bitmask operator^ (Bitmask x , Bitmask y ) \ + { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \ + ^ static_cast<boost::int_least32_t>(y)); } \ + \ + inline Bitmask operator~ (Bitmask x ) \ + { return static_cast<Bitmask>(~static_cast<boost::int_least32_t>(x)); } \ + \ + inline Bitmask & operator&=(Bitmask & x , Bitmask y) \ + { x = x & y ; return x ; } \ + \ + inline Bitmask & operator|=(Bitmask & x , Bitmask y) \ + { x = x | y ; return x ; } \ + \ + inline Bitmask & operator^=(Bitmask & x , Bitmask y) \ + { x = x ^ y ; return x ; } + +#endif // BOOST_BITMASK_HPP +