From f77a318c3732541a5a2ddf18d9e4e69556825b18 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 27 Apr 2019 19:28:49 +0300 Subject: [PATCH] Remove BOOST_ENDIAN_LOG --- include/boost/endian/arithmetic.hpp | 20 ----------- include/boost/endian/buffers.hpp | 53 +---------------------------- test/buffer_test.cpp | 1 - test/endian_operations_test.cpp | 13 ------- test/loop_time_test.cpp | 1 - test/speed_test.cpp | 1 - 6 files changed, 1 insertion(+), 88 deletions(-) diff --git a/include/boost/endian/arithmetic.hpp b/include/boost/endian/arithmetic.hpp index 38e8bdc..3cb0171 100644 --- a/include/boost/endian/arithmetic.hpp +++ b/include/boost/endian/arithmetic.hpp @@ -26,10 +26,6 @@ # pragma warning(disable:4365) // conversion ... signed/unsigned mismatch #endif -#ifdef BOOST_ENDIAN_LOG -# include -#endif - #if defined(__BORLANDC__) || defined( __CODEGEARC__) # pragma pack(push, 1) #endif @@ -303,10 +299,6 @@ namespace endian endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "big, unaligned, " << n_bits << "-bits, construct(" << val << ")\n"; -# endif detail::store_big_endian(this->m_value, val); } # endif @@ -328,10 +320,6 @@ namespace endian endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "little, unaligned, " << n_bits << "-bits, construct(" << val << ")\n"; -# endif detail::store_little_endian(this->m_value, val); } # endif @@ -356,10 +344,6 @@ namespace endian endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "big, aligned, " << n_bits << "-bits, construct(" << val << ")\n"; -# endif this->m_value = ::boost::endian::native_to_big(val); } @@ -386,10 +370,6 @@ namespace endian endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "little, aligned, " << n_bits << "-bits, construct(" << val << ")\n"; -# endif this->m_value = ::boost::endian::native_to_little(val); } # endif diff --git a/include/boost/endian/buffers.hpp b/include/boost/endian/buffers.hpp index 51fe4f8..9ff6be9 100644 --- a/include/boost/endian/buffers.hpp +++ b/include/boost/endian/buffers.hpp @@ -2,6 +2,7 @@ // (C) Copyright Darin Adler 2000 // (C) Copyright Beman Dawes 2006, 2009, 2014 +// (C) Copyright Peter Dimov 2019 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt @@ -26,10 +27,6 @@ # pragma warning(disable: 4127) // conditional expression is constant #endif -#ifdef BOOST_ENDIAN_LOG -# include -#endif - #if defined(__BORLANDC__) || defined( __CODEGEARC__) # pragma pack(push, 1) #endif @@ -247,10 +244,6 @@ namespace endian } // namespace detail -# ifdef BOOST_ENDIAN_LOG - bool endian_log(true); -# endif - // endian_buffer class template specializations --------------------------------------// // Specializations that represent unaligned bytes. @@ -274,30 +267,16 @@ namespace endian endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT explicit endian_buffer(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "big, unaligned, " - << n_bits << "-bits, construct(" << val << ")\n"; -# endif detail::store_big_endian(m_value, val); } # endif endian_buffer & operator=(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if (endian_log) - std::cout << "big, unaligned, " << n_bits << "-bits, assign(" << val << ")\n"; -# endif detail::store_big_endian(m_value, val); return *this; } value_type value() const BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "big, unaligned, " << n_bits << "-bits, convert(" - << detail::load_big_endian(m_value) << ")\n"; -# endif return detail::load_big_endian(m_value); } const char* data() const BOOST_NOEXCEPT { return m_value; } @@ -316,11 +295,6 @@ namespace endian endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT explicit endian_buffer(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "little, unaligned, " << n_bits << "-bits, construct(" - << val << ")\n"; -# endif detail::store_little_endian(m_value, val); } # endif @@ -328,11 +302,6 @@ namespace endian { detail::store_little_endian(m_value, val); return *this; } value_type value() const BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "little, unaligned, " << n_bits << "-bits, convert(" - << detail::load_little_endian(m_value) << ")\n"; -# endif return detail::load_little_endian(m_value); } const char* data() const BOOST_NOEXCEPT { return m_value; } @@ -354,11 +323,6 @@ namespace endian endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT explicit endian_buffer(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "big, aligned, " << n_bits - << "-bits, construct(" << val << ")\n"; -# endif m_value = ::boost::endian::native_to_big(val); } @@ -374,11 +338,6 @@ namespace endian //} value_type value() const BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "big, aligned, " << n_bits << "-bits, convert(" - << ::boost::endian::big_to_native(m_value) << ")\n"; -# endif return ::boost::endian::big_to_native(m_value); } const char* data() const BOOST_NOEXCEPT @@ -399,11 +358,6 @@ namespace endian endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT explicit endian_buffer(T val) BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "little, aligned, " << n_bits - << "-bits, construct(" << val << ")\n"; -# endif m_value = ::boost::endian::native_to_little(val); } @@ -415,11 +369,6 @@ namespace endian } value_type value() const BOOST_NOEXCEPT { -# ifdef BOOST_ENDIAN_LOG - if ( endian_log ) - std::cout << "little, aligned, " << n_bits << "-bits, convert(" - << ::boost::endian::little_to_native(m_value) << ")\n"; -# endif return ::boost::endian::little_to_native(m_value); } const char* data() const BOOST_NOEXCEPT diff --git a/test/buffer_test.cpp b/test/buffer_test.cpp index ab119b5..e12e779 100644 --- a/test/buffer_test.cpp +++ b/test/buffer_test.cpp @@ -11,7 +11,6 @@ #include -//#define BOOST_ENDIAN_LOG #include #include #include diff --git a/test/endian_operations_test.cpp b/test/endian_operations_test.cpp index 5664251..a8084fe 100644 --- a/test/endian_operations_test.cpp +++ b/test/endian_operations_test.cpp @@ -14,8 +14,6 @@ // See endian_test for tests of endianness correctness, size, and value. -#define BOOST_ENDIAN_LOG - #include #ifdef _MSC_VER @@ -28,8 +26,6 @@ # pragma GCC diagnostic ignored "-Wconversion" #endif -#define BOOST_ENDIAN_LOG - #include #include #include @@ -372,8 +368,6 @@ void f_big_int32_ut(be::big_int32_t) {} int cpp_main(int, char * []) { - be::endian_log = false; - // make sure some simple things work be::big_int32_t o1(1); @@ -381,11 +375,6 @@ int cpp_main(int, char * []) be::big_int32_t o3(3LL); be::big_int64_t o4(1); - // use cases; if BOOST_ENDIAN_LOG is defined, will output to clog info on - // what overloads and conversions are actually being performed. - - be::endian_log = true; - std::clog << "set up test values\n"; be::big_int32_t big(12345); be::little_uint16_t little_u(10); @@ -486,8 +475,6 @@ int cpp_main(int, char * []) u2 = u1 + u4; std::clog << "\n"; - be::endian_log = false; - test_inserter_and_extractor(); // perform the indicated test on ~60*60 operand types diff --git a/test/loop_time_test.cpp b/test/loop_time_test.cpp index cff5690..82f33ea 100644 --- a/test/loop_time_test.cpp +++ b/test/loop_time_test.cpp @@ -8,7 +8,6 @@ //--------------------------------------------------------------------------------------// //#define BOOST_ENDIAN_NO_INTRINSICS -//#define BOOST_ENDIAN_LOG #include diff --git a/test/speed_test.cpp b/test/speed_test.cpp index 9a35267..22b0b79 100644 --- a/test/speed_test.cpp +++ b/test/speed_test.cpp @@ -8,7 +8,6 @@ //--------------------------------------------------------------------------------------// //#define BOOST_ENDIAN_NO_INTRINSICS -//#define BOOST_ENDIAN_LOG #include