serialization: detect byteswap builtins without autoconf tests

Rather than a complicated set of tests to decide which bswap functions to
use, always prefer the compiler built-ins when available.

These builtins and fallbacks can all be removed once we're using c++23, which
adds std::byteswap.
This commit is contained in:
Cory Fields
2024-02-27 18:29:24 +00:00
parent 297367b3bb
commit 432b18ca8d
4 changed files with 60 additions and 45 deletions

View File

@@ -16,9 +16,9 @@ BOOST_AUTO_TEST_CASE(bswap_tests)
uint16_t e1 = 0x3412;
uint32_t e2 = 0xbc9a7856;
uint64_t e3 = 0xbc9a78563412f0de;
BOOST_CHECK(bswap_16(u1) == e1);
BOOST_CHECK(bswap_32(u2) == e2);
BOOST_CHECK(bswap_64(u3) == e3);
BOOST_CHECK(internal_bswap_16(u1) == e1);
BOOST_CHECK(internal_bswap_32(u2) == e2);
BOOST_CHECK(internal_bswap_64(u3) == e3);
}
BOOST_AUTO_TEST_SUITE_END()