• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 Peter Dimov
2 // Distributed under the Boost Software License, Version 1.0.
3 // https://www.boost.org/LICENSE_1_0.txt
4 
5 #include <boost/endian/conversion.hpp>
6 #include <boost/core/lightweight_test.hpp>
7 #include <boost/config.hpp>
8 #include <cstddef>
9 
main()10 int main()
11 {
12     int v[] = { 1, 2 };
13 
14     boost::endian::endian_reverse_inplace( v );
15     boost::endian::endian_reverse_inplace( v );
16     BOOST_TEST_EQ( v[0], 1 );
17     BOOST_TEST_EQ( v[1], 2 );
18 
19     boost::endian::native_to_little_inplace( v );
20     boost::endian::little_to_native_inplace( v );
21     BOOST_TEST_EQ( v[0], 1 );
22     BOOST_TEST_EQ( v[1], 2 );
23 
24     boost::endian::native_to_big_inplace( v );
25     boost::endian::big_to_native_inplace( v );
26     BOOST_TEST_EQ( v[0], 1 );
27     BOOST_TEST_EQ( v[1], 2 );
28 
29     return boost::report_errors();
30 }
31