diff --git a/boost/integer/endian.hpp b/boost/integer/endian.hpp index a473695..bfe2317 100644 --- a/boost/integer/endian.hpp +++ b/boost/integer/endian.hpp @@ -1,4 +1,4 @@ -// Boost endian.hpp header file (proposed) ----------------------------------// +// Boost endian.hpp header file ---------------------------------------------// // (C) Copyright Darin Adler 2000 // (C) Copyright Beman Dawes 2006 @@ -27,7 +27,7 @@ #define BOOST_ENDIAN_HPP #include -#include +//#include #include #include #include @@ -44,6 +44,11 @@ # define BOOST_ENDIAN_DEFAULTED {} // C++03 # endif +# if defined(BOOST_NO_DEFAULTED_FUNCTIONS) && defined(BOOST_ENDIANS_IN_UNIONS) +# define BOOST_ENDIAN_NO_CTORS +# endif + + namespace boost { namespace detail @@ -155,12 +160,12 @@ namespace boost // unaligned big endian specialization template class endian< endianness::big, T, n_bits, alignment::unaligned > - : cover_operators< endian< endianness::big, T, n_bits >, T > + // : cover_operators< endian< endianness::big, T, n_bits >, T > { BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits ); public: typedef T value_type; -# if !defined(BOOST_NO_DEFAULTED_FUNCTIONS) || !defined(BOOST_ENDIANS_IN_UNIONS) +# ifndef BOOST_ENDIAN_NO_CTORS endian() BOOST_ENDIAN_DEFAULTED endian(T val) { detail::store_big_endian(m_value, val); } # endif @@ -173,12 +178,12 @@ namespace boost // unaligned little endian specialization template class endian< endianness::little, T, n_bits, alignment::unaligned > - : cover_operators< endian< endianness::little, T, n_bits >, T > +// : cover_operators< endian< endianness::little, T, n_bits >, T > { BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits ); public: typedef T value_type; -# if !defined(BOOST_NO_DEFAULTED_FUNCTIONS) || !defined(BOOST_ENDIANS_IN_UNIONS) +# ifndef BOOST_ENDIAN_NO_CTORS endian() BOOST_ENDIAN_DEFAULTED endian(T val) { detail::store_little_endian(m_value, val); } # endif @@ -191,12 +196,12 @@ namespace boost // unaligned native endian specialization template class endian< endianness::native, T, n_bits, alignment::unaligned > - : cover_operators< endian< endianness::native, T, n_bits >, T > +// : cover_operators< endian< endianness::native, T, n_bits >, T > { BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits ); public: typedef T value_type; -# if !defined(BOOST_NO_DEFAULTED_FUNCTIONS) || !defined(BOOST_ENDIANS_IN_UNIONS) +# ifndef BOOST_ENDIAN_NO_CTORS endian() BOOST_ENDIAN_DEFAULTED # ifdef BOOST_BIG_ENDIAN endian(T val) { detail::store_big_endian(m_value, val); } @@ -221,13 +226,13 @@ namespace boost // aligned big endian specialization template class endian< endianness::big, T, n_bits, alignment::aligned > - : cover_operators< endian< endianness::big, T, n_bits, alignment::aligned >, T > +// : cover_operators< endian< endianness::big, T, n_bits, alignment::aligned >, T > { BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits ); BOOST_STATIC_ASSERT( sizeof(T) == n_bits/8 ); public: typedef T value_type; -# if !defined(BOOST_NO_DEFAULTED_FUNCTIONS) || !defined(BOOST_ENDIANS_IN_UNIONS) +# ifndef BOOST_ENDIAN_NO_CTORS endian() BOOST_ENDIAN_DEFAULTED # ifdef BOOST_BIG_ENDIAN endian(T val) : m_value(val) { } @@ -249,13 +254,13 @@ namespace boost // aligned little endian specialization template class endian< endianness::little, T, n_bits, alignment::aligned > - : cover_operators< endian< endianness::little, T, n_bits, alignment::aligned >, T > +// : cover_operators< endian< endianness::little, T, n_bits, alignment::aligned >, T > { BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits ); BOOST_STATIC_ASSERT( sizeof(T) == n_bits/8 ); public: typedef T value_type; -# if !defined(BOOST_NO_DEFAULTED_FUNCTIONS) || !defined(BOOST_ENDIANS_IN_UNIONS) +# ifndef BOOST_ENDIAN_NO_CTORS endian() BOOST_ENDIAN_DEFAULTED # ifdef BOOST_BIG_ENDIAN endian(T val) : m_value(val) { } diff --git a/libs/integer/test/endian-in-sandbox/endian-in-sandbox.sln b/libs/integer/test/endian-in-sandbox/endian-in-sandbox.sln index 8d53cb4..36e4506 100644 --- a/libs/integer/test/endian-in-sandbox/endian-in-sandbox.sln +++ b/libs/integer/test/endian-in-sandbox/endian-in-sandbox.sln @@ -5,6 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_test", "endian_test\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_in_union_test", "endian_in_union_test\endian_in_union_test.vcproj", "{3926C6DC-9D1E-4227-BEF5-81F5EC621A75}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "endian_operations_test", "endian_operations_test\endian_operations_test.vcproj", "{A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -19,6 +21,10 @@ Global {3926C6DC-9D1E-4227-BEF5-81F5EC621A75}.Debug|Win32.Build.0 = Debug|Win32 {3926C6DC-9D1E-4227-BEF5-81F5EC621A75}.Release|Win32.ActiveCfg = Release|Win32 {3926C6DC-9D1E-4227-BEF5-81F5EC621A75}.Release|Win32.Build.0 = Release|Win32 + {A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}.Debug|Win32.ActiveCfg = Debug|Win32 + {A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}.Debug|Win32.Build.0 = Debug|Win32 + {A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}.Release|Win32.ActiveCfg = Release|Win32 + {A0060A5B-673C-4AD8-BD08-A5C643B1A1CB}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcproj b/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcproj new file mode 100644 index 0000000..cebb66e --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_in_union_test/endian_in_union_test.vcproj @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcproj b/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcproj new file mode 100644 index 0000000..384d449 --- /dev/null +++ b/libs/integer/test/endian-in-sandbox/endian_operations_test/endian_operations_test.vcproj @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcproj b/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcproj index bbc12c1..c37e2f5 100644 --- a/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcproj +++ b/libs/integer/test/endian-in-sandbox/endian_test/endian_test.vcproj @@ -40,6 +40,7 @@ +#include + +#ifdef _MSC_VER +# pragma warning( disable : 4244 ) +#endif + +using namespace boost::integer; + +template +struct default_construct +{ + static void test() + { + T1 o1; + o1 = 1; // quiet warnings + } +}; + +template +struct construct +{ + static void test() + { + T2 o2(1); + T1 o1(o2); + } +}; + +template +struct assign +{ + static void test() + { + T2 o2; + o2 = 123; + T1 o1; + o1 = 02; + } +}; + +template +struct pass +{ + static void test() + { + } +}; + +template +struct compare +{ + static void test() + { + T1 o1 = 1; + T2 o2 = 2; + if (o1 == o2) return; + } +}; + +template class Test, class T1> +void op_test_aux() +{ + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + Test::test(); + +} + +template class Test> +void op_test() +{ + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); + op_test_aux(); +} + +int main() +{ + + + big32_t o1(1); + big32_t o2(2L); + big32_t o3(3LL); + + op_test(); + op_test(); + op_test(); + op_test(); + op_test(); + return 0; +}