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 | |
10 | int main() |
11 | { |
12 | int v[] = { 1, 2 }; |
13 | |
14 | boost::endian::endian_reverse_inplace( x&: v ); |
15 | boost::endian::endian_reverse_inplace( x&: v ); |
16 | BOOST_TEST_EQ( v[0], 1 ); |
17 | BOOST_TEST_EQ( v[1], 2 ); |
18 | |
19 | boost::endian::native_to_little_inplace( x&: v ); |
20 | boost::endian::little_to_native_inplace( x&: v ); |
21 | BOOST_TEST_EQ( v[0], 1 ); |
22 | BOOST_TEST_EQ( v[1], 2 ); |
23 | |
24 | boost::endian::native_to_big_inplace( x&: v ); |
25 | boost::endian::big_to_native_inplace( x&: v ); |
26 | BOOST_TEST_EQ( v[0], 1 ); |
27 | BOOST_TEST_EQ( v[1], 2 ); |
28 | |
29 | return boost::report_errors(); |
30 | } |
31 |