]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/spirit/home/karma/binary/binary.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / spirit / home / karma / binary / binary.hpp
index 223026428015a036e92f6a484a02e2d266a25282..02418f31b1d68041fcdad7831fef00a1201704d9 100644 (file)
@@ -194,20 +194,11 @@ namespace boost { namespace spirit { namespace karma
         };
 
         ///////////////////////////////////////////////////////////////////////
-        template <BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) bits>
+        template <BOOST_SCOPED_ENUM(boost::endian::order) bits>
         struct what;
 
         template <>
-        struct what<boost::spirit::endian::endianness::native>
-        {
-            static info is()
-            {
-                return info("native-endian binary");
-            }
-        };
-
-        template <>
-        struct what<boost::spirit::endian::endianness::little>
+        struct what<boost::endian::order::little>
         {
             static info is()
             {
@@ -216,7 +207,7 @@ namespace boost { namespace spirit { namespace karma
         };
 
         template <>
-        struct what<boost::spirit::endian::endianness::big>
+        struct what<boost::endian::order::big>
         {
             static info is()
             {
@@ -226,7 +217,7 @@ namespace boost { namespace spirit { namespace karma
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) endian, int bits>
+    template <typename T, BOOST_SCOPED_ENUM(boost::endian::order) endian, int bits>
     struct any_binary_generator
       : primitive_generator<any_binary_generator<T, endian, bits> >
     {
@@ -242,10 +233,7 @@ namespace boost { namespace spirit { namespace karma
             if (!traits::has_optional_value(attr))
                 return false;
 
-            // Even if the endian types are not pod's (at least not in the
-            // definition of C++03) it seems to be safe to assume they are.
-            // This allows us to treat them as a sequence of consecutive bytes.
-            boost::spirit::endian::endian<endian, typename T::type, bits> p;
+            boost::endian::endian_arithmetic<endian, typename T::type, bits> p;
 
 #if defined(BOOST_MSVC)
 // warning C4244: 'argument' : conversion from 'const int' to 'foo', possible loss of data
@@ -258,8 +246,7 @@ namespace boost { namespace spirit { namespace karma
 #pragma warning(pop)
 #endif
 
-            unsigned char const* bytes =
-                reinterpret_cast<unsigned char const*>(&p);
+            unsigned char const* bytes = p.data();
 
             for (unsigned int i = 0; i < sizeof(p); ++i)
             {
@@ -293,7 +280,7 @@ namespace boost { namespace spirit { namespace karma
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) endian, int bits>
+    template <typename T, BOOST_SCOPED_ENUM(boost::endian::order) endian, int bits>
     struct literal_binary_generator
       : primitive_generator<literal_binary_generator<T, endian, bits> >
     {
@@ -323,12 +310,7 @@ namespace boost { namespace spirit { namespace karma
         bool generate(OutputIterator& sink, Context&, Delimiter const& d
           , Attribute const&) const
         {
-            // Even if the endian types are not pod's (at least not in the
-            // definition of C++03) it seems to be safe to assume they are
-            // (but in C++0x the endian types _are_ PODs).
-            // This allows us to treat them as a sequence of consecutive bytes.
-            unsigned char const* bytes =
-                reinterpret_cast<unsigned char const*>(&data_);
+            unsigned char const* bytes = data_.data();
 
             for (unsigned int i = 0; i < sizeof(data_type); ++i)
             {
@@ -344,7 +326,7 @@ namespace boost { namespace spirit { namespace karma
             return karma::detail::what<endian>::is();
         }
 
-        typedef boost::spirit::endian::endian<endian, typename T::type,
+        typedef boost::endian::endian_arithmetic<endian, typename T::type,
             bits> data_type;
 
         data_type data_;
@@ -355,7 +337,7 @@ namespace boost { namespace spirit { namespace karma
     ///////////////////////////////////////////////////////////////////////////
     namespace detail
     {
-        template <typename T, BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) endian
+        template <typename T, BOOST_SCOPED_ENUM(boost::endian::order) endian
           , int bits>
         struct basic_binary
         {
@@ -368,7 +350,7 @@ namespace boost { namespace spirit { namespace karma
         };
 
         template <typename Modifiers, typename T
-          , BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) endian, int bits>
+          , BOOST_SCOPED_ENUM(boost::endian::order) endian, int bits>
         struct basic_binary_literal
         {
             typedef literal_binary_generator<T, endian, bits> result_type;
@@ -385,13 +367,13 @@ namespace boost { namespace spirit { namespace karma
     template <typename Modifiers>                                             \
     struct make_primitive<tag::name, Modifiers>                               \
       : detail::basic_binary<detail::integer<bits>,                           \
-        boost::spirit::endian::endianness::endiantype, bits> {};              \
+        boost::endian::order::endiantype, bits> {};                           \
                                                                               \
     template <typename Modifiers, typename A0>                                \
     struct make_primitive<terminal_ex<tag::name, fusion::vector1<A0> >        \
           , Modifiers>                                                        \
       : detail::basic_binary_literal<Modifiers, detail::integer<bits>         \
-        , boost::spirit::endian::endianness::endiantype, bits> {};            \
+        , boost::endian::order::endiantype, bits> {};                         \
                                                                               \
     /***/
 
@@ -414,13 +396,13 @@ namespace boost { namespace spirit { namespace karma
     template <typename Modifiers>                                             \
     struct make_primitive<tag::name, Modifiers>                               \
       : detail::basic_binary<detail::floating_point<bits>,                    \
-        boost::spirit::endian::endianness::endiantype, bits> {};              \
+        boost::endian::order::endiantype, bits> {};                           \
                                                                               \
     template <typename Modifiers, typename A0>                                \
     struct make_primitive<terminal_ex<tag::name, fusion::vector1<A0> >        \
           , Modifiers>                                                        \
       : detail::basic_binary_literal<Modifiers, detail::floating_point<bits>  \
-        , boost::spirit::endian::endianness::endiantype, bits> {};            \
+        , boost::endian::order::endiantype, bits> {};                         \
                                                                               \
     /***/