]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/detail/include/boost/detail/bitmask.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / detail / include / boost / detail / bitmask.hpp
1 // boost/detail/bitmask.hpp ------------------------------------------------//
2
3 // Copyright Beman Dawes 2006
4
5 // Distributed under the Boost Software License, Version 1.0
6 // http://www.boost.org/LICENSE_1_0.txt
7
8 // Usage: enum foo { a=1, b=2, c=4 };
9 // BOOST_BITMASK( foo );
10 //
11 // void f( foo arg );
12 // ...
13 // f( a | c );
14
15 #ifndef BOOST_BITMASK_HPP
16 #define BOOST_BITMASK_HPP
17
18 #include <boost/cstdint.hpp>
19
20 #define BOOST_BITMASK(Bitmask) \
21 \
22 inline Bitmask operator| (Bitmask x , Bitmask y ) \
23 { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
24 | static_cast<boost::int_least32_t>(y)); } \
25 \
26 inline Bitmask operator& (Bitmask x , Bitmask y ) \
27 { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
28 & static_cast<boost::int_least32_t>(y)); } \
29 \
30 inline Bitmask operator^ (Bitmask x , Bitmask y ) \
31 { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
32 ^ static_cast<boost::int_least32_t>(y)); } \
33 \
34 inline Bitmask operator~ (Bitmask x ) \
35 { return static_cast<Bitmask>(~static_cast<boost::int_least32_t>(x)); } \
36 \
37 inline Bitmask & operator&=(Bitmask & x , Bitmask y) \
38 { x = x & y ; return x ; } \
39 \
40 inline Bitmask & operator|=(Bitmask & x , Bitmask y) \
41 { x = x | y ; return x ; } \
42 \
43 inline Bitmask & operator^=(Bitmask & x , Bitmask y) \
44 { x = x ^ y ; return x ; }
45
46 #endif // BOOST_BITMASK_HPP
47