forked from boostorg/endian
Remove use of Predef in endian_test.cpp
This commit is contained in:
@ -28,6 +28,10 @@
|
|||||||
#include <cstdlib> // for atoi(), exit()
|
#include <cstdlib> // for atoi(), exit()
|
||||||
#include <cstring> // for memcmp()
|
#include <cstring> // for memcmp()
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# pragma warning(disable: 4127) // conditional expression is constant
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std; // Not the best programming practice, but I
|
using namespace std; // Not the best programming practice, but I
|
||||||
using namespace boost; // want to verify this combination of using
|
using namespace boost; // want to verify this combination of using
|
||||||
using namespace boost::endian; // namespaces works. See endian_operations_test
|
using namespace boost::endian; // namespaces works. See endian_operations_test
|
||||||
@ -102,11 +106,7 @@ namespace
|
|||||||
template <class Endian>
|
template <class Endian>
|
||||||
inline void verify_native_representation( int line )
|
inline void verify_native_representation( int line )
|
||||||
{
|
{
|
||||||
# if BOOST_ENDIAN_BIG_BYTE
|
verify_representation<Endian>( order::native == order::big, line );
|
||||||
verify_representation<Endian>( true, line );
|
|
||||||
# else
|
|
||||||
verify_representation<Endian>( false, line );
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect_order -----------------------------------------------------//
|
// detect_order -----------------------------------------------------//
|
||||||
@ -124,22 +124,24 @@ namespace
|
|||||||
if ( memcmp( v.c, "\x8\7\6\5\4\3\2\1", 8) == 0 )
|
if ( memcmp( v.c, "\x8\7\6\5\4\3\2\1", 8) == 0 )
|
||||||
{
|
{
|
||||||
cout << "This machine is little-endian.\n";
|
cout << "This machine is little-endian.\n";
|
||||||
# if !BOOST_ENDIAN_LITTLE_BYTE
|
if( order::native != order::little )
|
||||||
cout << "yet boost/predef/other/endian.h does not define BOOST_ENDIAN_LITTLE_BYTE.\n"
|
{
|
||||||
|
cout << "yet boost::endian::order::native does not equal boost::endian::order::little.\n"
|
||||||
"The Boost Endian library must be revised to work correctly on this system.\n"
|
"The Boost Endian library must be revised to work correctly on this system.\n"
|
||||||
"Please report this problem to the Boost mailing list.\n";
|
"Please report this problem to the Boost mailing list.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
# endif
|
}
|
||||||
}
|
}
|
||||||
else if ( memcmp( v.c, "\1\2\3\4\5\6\7\x8", 8) == 0 )
|
else if ( memcmp( v.c, "\1\2\3\4\5\6\7\x8", 8) == 0 )
|
||||||
{
|
{
|
||||||
cout << "This machine is big-endian.\n";
|
cout << "This machine is big-endian.\n";
|
||||||
# if !BOOST_ENDIAN_BIG_BYTE
|
if( order::native != order::big )
|
||||||
cout << "yet boost/predef/other/endian.h does not define BOOST_ENDIAN_BIG_BYTE.\n"
|
{
|
||||||
|
cout << "yet boost::endian::order::native does not equal boost::endian::order::big.\n"
|
||||||
"The Boost Endian library must be revised to work correctly on this system.\n"
|
"The Boost Endian library must be revised to work correctly on this system.\n"
|
||||||
"Please report this problem to the Boost mailing list.\n";
|
"Please report this problem to the Boost mailing list.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
# endif
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user