Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62836 - sandbox/endian_ext/boost/integer
From: vicente.botet_at_[hidden]
Date: 2010-06-12 06:30:41


Author: viboes
Date: 2010-06-12 06:30:40 EDT (Sat, 12 Jun 2010)
New Revision: 62836
URL: http://svn.boost.org/trac/boost/changeset/62836

Log:
Change namespace endian by endianess
Text files modified:
   sandbox/endian_ext/boost/integer/endian.hpp | 7 --
   sandbox/endian_ext/boost/integer/endian_conversion.hpp | 16 +++---
   sandbox/endian_ext/boost/integer/endian_pack.hpp | 27 ----------
   sandbox/endian_ext/boost/integer/endian_type.hpp | 96 +++------------------------------------
   sandbox/endian_ext/boost/integer/endian_view.hpp | 21 ++-----
   5 files changed, 27 insertions(+), 140 deletions(-)

Modified: sandbox/endian_ext/boost/integer/endian.hpp
==============================================================================
--- sandbox/endian_ext/boost/integer/endian.hpp (original)
+++ sandbox/endian_ext/boost/integer/endian.hpp 2010-06-12 06:30:40 EDT (Sat, 12 Jun 2010)
@@ -48,12 +48,7 @@
   namespace integer
   {
 
- template <
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- BOOST_SCOPED_ENUM(endianness) E,
-#else
- typename E,
-#endif
+ template <typename E,
         typename T,
         std::size_t n_bits=sizeof(T)*8,
         BOOST_SCOPED_ENUM(alignment) A = alignment::unaligned

Modified: sandbox/endian_ext/boost/integer/endian_conversion.hpp
==============================================================================
--- sandbox/endian_ext/boost/integer/endian_conversion.hpp (original)
+++ sandbox/endian_ext/boost/integer/endian_conversion.hpp 2010-06-12 06:30:40 EDT (Sat, 12 Jun 2010)
@@ -103,14 +103,14 @@
 
         // on fundamentals apply endian views
         template <typename T>
- struct convert_to_from<boost::endian::big, boost::endian::little, T, true, false> {
+ struct convert_to_from<endianness::big, endianness::little, T, true, false> {
             static void apply(T& r) {
                 as_big(r)=as_little(r);
             }
         };
         // on fundamentals apply endian views
         template <typename T>
- struct convert_to_from<boost::endian::little, boost::endian::big, T, true, false> {
+ struct convert_to_from<endianness::little, endianness::big, T, true, false> {
             static void apply(T& r) {
                 as_little(r)=as_big(r);
             }
@@ -144,8 +144,8 @@
 template <typename EndianTarget, typename EndianSource, typename T>
 inline void convert_to_from(T& r) {
     integer_detail::convert_to_from<
- typename boost::endian::domain_map<EndianTarget,T>::type,
- typename boost::endian::domain_map<EndianSource,T>::type,
+ typename endianness::domain_map<EndianTarget,T>::type,
+ typename endianness::domain_map<EndianSource,T>::type,
             T
>::apply(r);
 }
@@ -161,16 +161,16 @@
 template <typename EndianSource, typename T>
 void convert_from(T& r) {
     integer_detail::convert_to_from<
- typename boost::endian::domain_map<boost::endian::native,T>::type,
- typename boost::endian::domain_map<EndianSource,T>::type,
+ typename endianness::domain_map<endianness::native,T>::type,
+ typename endianness::domain_map<EndianSource,T>::type,
         T>::apply(r);
 }
 
 template <typename EndianTarget, typename T>
 void convert_to(T& r) {
     integer_detail::convert_to_from<
- typename boost::endian::domain_map<EndianTarget,T>::type,
- typename boost::endian::domain_map<boost::endian::native, T>::type,
+ typename endianness::domain_map<EndianTarget,T>::type,
+ typename endianness::domain_map<endianness::native, T>::type,
         T>::apply(r);
 }
 

Modified: sandbox/endian_ext/boost/integer/endian_pack.hpp
==============================================================================
--- sandbox/endian_ext/boost/integer/endian_pack.hpp (original)
+++ sandbox/endian_ext/boost/integer/endian_pack.hpp 2010-06-12 06:30:40 EDT (Sat, 12 Jun 2010)
@@ -43,9 +43,7 @@
 //~ #include <iosfwd>
 #include <climits>
 
-# ifndef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
 # include <boost/endian/endian.hpp>
-# endif
 
 # if CHAR_BIT != 8
 # error Platforms with CHAR_BIT != 8 are not supported
@@ -159,31 +157,10 @@
     bool endian_log(true);
 # endif
 
-
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- // endian class template and specializations ---------------------------------------//
-# ifdef BOOST_BIG_ENDIAN
- BOOST_SCOPED_ENUM_START(endianness) { big, little, mixed, native=big }; BOOST_SCOPED_ENUM_END
-# else
- BOOST_SCOPED_ENUM_START(endianness) { big, little, mixed, native=little }; BOOST_SCOPED_ENUM_END
-# endif
- const BOOST_SCOPED_ENUM_START(endianness) big_endian = endianness::big;
- const BOOST_SCOPED_ENUM_START(endianness) little_endian = endianness::little;
- const BOOST_SCOPED_ENUM_START(endianness) native_endian = endianness::native;
-#else
- typedef endian::big big_endian;
- typedef endian::little little_endian;
- typedef endian::native native_endian;
-# endif
-
+
     BOOST_SCOPED_ENUM_START(alignment) { unaligned, aligned }; BOOST_SCOPED_ENUM_END
 
- template <
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- BOOST_SCOPED_ENUM(endianness) E,
-#else
- typename E,
-#endif
+ template <typename E,
         typename T,
         std::size_t n_bits=sizeof(T)*8,
         BOOST_SCOPED_ENUM(alignment) A = alignment::unaligned

Modified: sandbox/endian_ext/boost/integer/endian_type.hpp
==============================================================================
--- sandbox/endian_ext/boost/integer/endian_type.hpp (original)
+++ sandbox/endian_ext/boost/integer/endian_type.hpp 2010-06-12 06:30:40 EDT (Sat, 12 Jun 2010)
@@ -52,32 +52,17 @@
 //~ // fundamental types are native
 template <typename T, bool IsSeq>
 struct endian_type_impl<T, true, IsSeq> {
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- static const BOOST_SCOPED_ENUM(endianness) value= endianness::native;
-#else
- typedef boost::endian::native type;
-#endif
-
+ typedef endianness::native type;
 };
 
 // we can consider that any other type which has not been explicitly declared is native, but it is more conservative to state that it could be mixted.
 template <typename T>
 struct endian_type_impl<T, false, false> {
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- static const BOOST_SCOPED_ENUM(endianness) value= endianness::mixed;
-#else
- typedef boost::endian::mixed type;
-#endif
+ typedef endianness::mixed type;
 };
 
 // if temp is equal the endian_type of the *it continue otherwise mixed
-template <
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- BOOST_SCOPED_ENUM(endianness) res,
-#else
- typename res,
-#endif
- typename It, typename End
+template <typename res, typename It, typename End
> struct endian_type_loop {
 private:
     typedef
@@ -86,46 +71,24 @@
                 typename fusion::result_of::deref<It>::type
>::type
>::type it_type;
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- typedef typename mpl::if_c<endian_type< it_type >::value==res,
- mpl::int_<endian_type_loop<res,typename fusion::result_of::next<It>::type, End>::value>,
- mpl::int_<endianness::mixed>
- >::type res_type;
-public:
- static const BOOST_SCOPED_ENUM(endianness) value= BOOST_SCOPED_ENUM(endianness)(res_type::value);
-# else
 public:
     typedef typename mpl::if_<is_same<typename endian_type< it_type >::type,res>,
         typename endian_type_loop<res,typename fusion::result_of::next<It>::type, End>::type,
- boost::endian::mixed
+ endianness::mixed
>::type type;
-# endif
 };
 
 // endian_type of mixed is mixed
 template <typename It, typename End>
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
 struct endian_type_loop<endianness::mixed,It,End> {
- static const BOOST_SCOPED_ENUM(endianness) value= endianness::mixed;
+ typedef endianness::mixed type;
 };
-#else
-struct endian_type_loop<boost::endian::mixed,It,End> {
- typedef boost::endian::mixed type;
-};
-#endif
 
 // temp when iteration ends
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
-template <BOOST_SCOPED_ENUM(endianness) temp, typename End>
-struct endian_type_loop<temp,End,End> {
- static const BOOST_SCOPED_ENUM(endianness) value= temp;
-};
-#else
 template <typename temp, typename End>
 struct endian_type_loop<temp,End,End> {
     typedef temp type;
 };
-#endif
 
 // fusion sequences are mixed if not all the elements habve the same endianess,
 // otherwise the endianess of all the types.
@@ -139,19 +102,10 @@
>::type front_type;
 
 public:
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- static const BOOST_SCOPED_ENUM(endianness) value=
- endian_type_loop<endian_type< front_type >::value,
- typename fusion::result_of::begin<Seq>::type,
- typename fusion::result_of::end<Seq>::type
- >::value;
-#else
     typedef typename endian_type_loop<typename endian_type< front_type >::type,
                     typename fusion::result_of::begin<Seq>::type,
                     typename fusion::result_of::end<Seq>::type
>::type type;
-#endif
-
 };
 
 
@@ -168,76 +122,44 @@
 
 // endianess of endian<E,T,n_bits,A> is E
 template <
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- BOOST_SCOPED_ENUM(endianness) E,
-# else
     typename E,
-# endif
     typename T,
     std::size_t n_bits,
     BOOST_SCOPED_ENUM(alignment) A
> struct endian_type<endian_pack<E,T,n_bits,A> >
 {
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- static const BOOST_SCOPED_ENUM(endianness) value= E;
-#else
     typedef E type;
-#endif
 };
 
 // endianess of endian<E,T,n_bits,A> is E
 template <
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- BOOST_SCOPED_ENUM(endianness) E,
-# else
     typename E,
-# endif
     typename T,
     std::size_t n_bits,
     BOOST_SCOPED_ENUM(alignment) A
> struct endian_type<endian<E,T,n_bits,A> >
 {
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- static const BOOST_SCOPED_ENUM(endianness) value= E;
-#else
     typedef E type;
-#endif
 };
 
 template <typename T>
 struct is_native :
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- mpl::bool_<endian_type<T>::value== endianness::native>
-#else
- is_same<typename endian_type<T>::type, boost::endian::native>
-#endif
+ is_same<typename endian_type<T>::type, endianness::native>
 {};
 
 template <typename T>
 struct is_big :
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- mpl::bool_<endian_type<T>::value== endianness::big>
-#else
- is_same<typename endian_type<T>::type, boost::endian::big>
-#endif
+ is_same<typename endian_type<T>::type, endianness::big>
 {};
 
 template <typename T>
 struct is_little :
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- mpl::bool_<endian_type<T>::value== endianness::little>
-#else
- is_same<typename endian_type<T>::type, boost::endian::little>
-#endif
+ is_same<typename endian_type<T>::type, endianness::little>
 {};
 
 template <typename T>
 struct is_mixed :
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- mpl::bool_<endian_type<T>::value== endianness::mixed>
-#else
- is_same<typename endian_type<T>::type, boost::endian::mixed>
-#endif
+ is_same<typename endian_type<T>::type, endianness::mixed>
 {};
 
 

Modified: sandbox/endian_ext/boost/integer/endian_view.hpp
==============================================================================
--- sandbox/endian_ext/boost/integer/endian_view.hpp (original)
+++ sandbox/endian_ext/boost/integer/endian_view.hpp 2010-06-12 06:30:40 EDT (Sat, 12 Jun 2010)
@@ -13,7 +13,7 @@
 #ifndef BOOST_INTEGER_ENDIAN_VIEW_HPP
 #define BOOST_INTEGER_ENDIAN_VIEW_HPP
 
-#include <boost/integer/endian.hpp>
+#include <boost/integer/endian_pack.hpp>
 
 namespace boost {
 
@@ -37,31 +37,24 @@
         }
     };
 
- template <
-# ifdef BOOST_INTEGER_ENDIAN_USES_ENDIANNESS
- BOOST_SCOPED_ENUM(endianness) E,
-#else
- typename E,
-#endif
- typename T
- >
- endian_view<endian<E,T> > as_endian(T& v) {
- return endian_view<endian<E,T> >(v);
+ template <typename E, typename T>
+ endian_view<endian_pack<E,T> > as_endian(T& v) {
+ return endian_view<endian_pack<E,T> >(v);
     }
  
     template <typename T>
- endian_view<endian<native_endian,T> > as(T& v)
+ endian_view<endian_pack<native_endian,T> > as(T& v)
     {
         return as_endian<native_endian>(v);
     }
     template <typename T>
- endian_view<endian<little_endian,T> > as_little(T& v)
+ endian_view<endian_pack<little_endian,T> > as_little(T& v)
     {
         return as_endian<little_endian>(v);
     }
     
     template <typename T>
- endian_view<endian<big_endian,T> > as_big(T& v)
+ endian_view<endian_pack<big_endian,T> > as_big(T& v)
     {
         return as_endian<big_endian>(v);
     }


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