Use an unaligned type instead of double in packed_*_test

This commit is contained in:
Peter Dimov
2020-10-07 01:37:03 +03:00
parent 84f15c4fb2
commit b0b9622ceb
2 changed files with 10 additions and 4 deletions

View File

@ -20,13 +20,18 @@ using namespace boost::endian;
struct X
{
big_uint16_t a;
double b;
native_float64_t b;
little_uint16_t c;
} __attribute__((packed));
int main()
{
BOOST_TEST_EQ( sizeof( X ), 12 );
BOOST_TEST_EQ( sizeof(big_uint16_t), 2 );
BOOST_TEST_EQ( sizeof(native_float64_t), 8 );
BOOST_TEST_EQ( sizeof(little_uint16_t), 2 );
BOOST_TEST_EQ( sizeof(X), 12 );
return boost::report_errors();
}