Remove BOOST_ENDIAN_LOG

This commit is contained in:
Peter Dimov
2019-04-27 19:28:49 +03:00
parent 8e3eccaa14
commit f77a318c37
6 changed files with 1 additions and 88 deletions

View File

@ -26,10 +26,6 @@
# pragma warning(disable:4365) // conversion ... signed/unsigned mismatch # pragma warning(disable:4365) // conversion ... signed/unsigned mismatch
#endif #endif
#ifdef BOOST_ENDIAN_LOG
# include <iostream>
#endif
#if defined(__BORLANDC__) || defined( __CODEGEARC__) #if defined(__BORLANDC__) || defined( __CODEGEARC__)
# pragma pack(push, 1) # pragma pack(push, 1)
#endif #endif
@ -303,10 +299,6 @@ namespace endian
endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT
BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(T val) BOOST_NOEXCEPT 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<T, n_bits/8>(this->m_value, val); detail::store_big_endian<T, n_bits/8>(this->m_value, val);
} }
# endif # endif
@ -328,10 +320,6 @@ namespace endian
endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT
BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(T val) BOOST_NOEXCEPT 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<T, n_bits/8>(this->m_value, val); detail::store_little_endian<T, n_bits/8>(this->m_value, val);
} }
# endif # endif
@ -356,10 +344,6 @@ namespace endian
endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT
BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(T val) BOOST_NOEXCEPT 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); this->m_value = ::boost::endian::native_to_big(val);
} }
@ -386,10 +370,6 @@ namespace endian
endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT
BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(T val) BOOST_NOEXCEPT 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); this->m_value = ::boost::endian::native_to_little(val);
} }
# endif # endif

View File

@ -2,6 +2,7 @@
// (C) Copyright Darin Adler 2000 // (C) Copyright Darin Adler 2000
// (C) Copyright Beman Dawes 2006, 2009, 2014 // (C) Copyright Beman Dawes 2006, 2009, 2014
// (C) Copyright Peter Dimov 2019
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt // See http://www.boost.org/LICENSE_1_0.txt
@ -26,10 +27,6 @@
# pragma warning(disable: 4127) // conditional expression is constant # pragma warning(disable: 4127) // conditional expression is constant
#endif #endif
#ifdef BOOST_ENDIAN_LOG
# include <iostream>
#endif
#if defined(__BORLANDC__) || defined( __CODEGEARC__) #if defined(__BORLANDC__) || defined( __CODEGEARC__)
# pragma pack(push, 1) # pragma pack(push, 1)
#endif #endif
@ -247,10 +244,6 @@ namespace endian
} // namespace detail } // namespace detail
# ifdef BOOST_ENDIAN_LOG
bool endian_log(true);
# endif
// endian_buffer class template specializations --------------------------------------// // endian_buffer class template specializations --------------------------------------//
// Specializations that represent unaligned bytes. // Specializations that represent unaligned bytes.
@ -274,30 +267,16 @@ namespace endian
endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT
explicit endian_buffer(T val) BOOST_NOEXCEPT 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<T, n_bits/8>(m_value, val); detail::store_big_endian<T, n_bits/8>(m_value, val);
} }
# endif # endif
endian_buffer & operator=(T val) BOOST_NOEXCEPT 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<T, n_bits/8>(m_value, val); detail::store_big_endian<T, n_bits/8>(m_value, val);
return *this; return *this;
} }
value_type value() const BOOST_NOEXCEPT 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<T, n_bits/8>(m_value) << ")\n";
# endif
return detail::load_big_endian<T, n_bits/8>(m_value); return detail::load_big_endian<T, n_bits/8>(m_value);
} }
const char* data() const BOOST_NOEXCEPT { return m_value; } const char* data() const BOOST_NOEXCEPT { return m_value; }
@ -316,11 +295,6 @@ namespace endian
endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT
explicit endian_buffer(T val) BOOST_NOEXCEPT 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<T, n_bits/8>(m_value, val); detail::store_little_endian<T, n_bits/8>(m_value, val);
} }
# endif # endif
@ -328,11 +302,6 @@ namespace endian
{ detail::store_little_endian<T, n_bits/8>(m_value, val); return *this; } { detail::store_little_endian<T, n_bits/8>(m_value, val); return *this; }
value_type value() const BOOST_NOEXCEPT 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<T, n_bits/8>(m_value) << ")\n";
# endif
return detail::load_little_endian<T, n_bits/8>(m_value); return detail::load_little_endian<T, n_bits/8>(m_value);
} }
const char* data() const BOOST_NOEXCEPT { return m_value; } const char* data() const BOOST_NOEXCEPT { return m_value; }
@ -354,11 +323,6 @@ namespace endian
endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT
explicit endian_buffer(T val) BOOST_NOEXCEPT 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); m_value = ::boost::endian::native_to_big(val);
} }
@ -374,11 +338,6 @@ namespace endian
//} //}
value_type value() const BOOST_NOEXCEPT 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); return ::boost::endian::big_to_native(m_value);
} }
const char* data() const BOOST_NOEXCEPT const char* data() const BOOST_NOEXCEPT
@ -399,11 +358,6 @@ namespace endian
endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT
explicit endian_buffer(T val) BOOST_NOEXCEPT 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); m_value = ::boost::endian::native_to_little(val);
} }
@ -415,11 +369,6 @@ namespace endian
} }
value_type value() const BOOST_NOEXCEPT 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); return ::boost::endian::little_to_native(m_value);
} }
const char* data() const BOOST_NOEXCEPT const char* data() const BOOST_NOEXCEPT

View File

@ -11,7 +11,6 @@
#include <boost/endian/detail/disable_warnings.hpp> #include <boost/endian/detail/disable_warnings.hpp>
//#define BOOST_ENDIAN_LOG
#include <boost/endian/buffers.hpp> #include <boost/endian/buffers.hpp>
#include <boost/detail/lightweight_main.hpp> #include <boost/detail/lightweight_main.hpp>
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>

View File

@ -14,8 +14,6 @@
// See endian_test for tests of endianness correctness, size, and value. // See endian_test for tests of endianness correctness, size, and value.
#define BOOST_ENDIAN_LOG
#include <boost/endian/detail/disable_warnings.hpp> #include <boost/endian/detail/disable_warnings.hpp>
#ifdef _MSC_VER #ifdef _MSC_VER
@ -28,8 +26,6 @@
# pragma GCC diagnostic ignored "-Wconversion" # pragma GCC diagnostic ignored "-Wconversion"
#endif #endif
#define BOOST_ENDIAN_LOG
#include <boost/endian/arithmetic.hpp> #include <boost/endian/arithmetic.hpp>
#include <boost/type_traits/is_signed.hpp> #include <boost/type_traits/is_signed.hpp>
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>
@ -372,8 +368,6 @@ void f_big_int32_ut(be::big_int32_t) {}
int cpp_main(int, char * []) int cpp_main(int, char * [])
{ {
be::endian_log = false;
// make sure some simple things work // make sure some simple things work
be::big_int32_t o1(1); be::big_int32_t o1(1);
@ -381,11 +375,6 @@ int cpp_main(int, char * [])
be::big_int32_t o3(3LL); be::big_int32_t o3(3LL);
be::big_int64_t o4(1); 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"; std::clog << "set up test values\n";
be::big_int32_t big(12345); be::big_int32_t big(12345);
be::little_uint16_t little_u(10); be::little_uint16_t little_u(10);
@ -486,8 +475,6 @@ int cpp_main(int, char * [])
u2 = u1 + u4; u2 = u1 + u4;
std::clog << "\n"; std::clog << "\n";
be::endian_log = false;
test_inserter_and_extractor(); test_inserter_and_extractor();
// perform the indicated test on ~60*60 operand types // perform the indicated test on ~60*60 operand types

View File

@ -8,7 +8,6 @@
//--------------------------------------------------------------------------------------// //--------------------------------------------------------------------------------------//
//#define BOOST_ENDIAN_NO_INTRINSICS //#define BOOST_ENDIAN_NO_INTRINSICS
//#define BOOST_ENDIAN_LOG
#include <boost/endian/detail/disable_warnings.hpp> #include <boost/endian/detail/disable_warnings.hpp>

View File

@ -8,7 +8,6 @@
//--------------------------------------------------------------------------------------// //--------------------------------------------------------------------------------------//
//#define BOOST_ENDIAN_NO_INTRINSICS //#define BOOST_ENDIAN_NO_INTRINSICS
//#define BOOST_ENDIAN_LOG
#include <boost/endian/detail/disable_warnings.hpp> #include <boost/endian/detail/disable_warnings.hpp>