12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef BOOST_BITMASK_HPP
- #define BOOST_BITMASK_HPP
- #include <boost/config.hpp>
- #include <boost/cstdint.hpp>
- #define BOOST_BITMASK(Bitmask) \
- \
- inline BOOST_CONSTEXPR 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 BOOST_CONSTEXPR 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 BOOST_CONSTEXPR 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 BOOST_CONSTEXPR 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 ; } \
- \
- \
- \
- inline BOOST_CONSTEXPR bool operator!(Bitmask x) \
- { return !static_cast<int>(x); } \
- \
- inline BOOST_CONSTEXPR bool bitmask_set(Bitmask x) \
- { return !!x; }
- #endif
|