mirror of
https://github.com/boostorg/endian.git
synced 2025-07-30 20:47:26 +02:00
Use an unaligned type instead of double in packed_*_test
This commit is contained in:
@ -20,13 +20,18 @@ using namespace boost::endian;
|
|||||||
struct X
|
struct X
|
||||||
{
|
{
|
||||||
big_uint16_t a;
|
big_uint16_t a;
|
||||||
double b;
|
native_float64_t b;
|
||||||
little_uint16_t c;
|
little_uint16_t c;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
int main()
|
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();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,15 +20,16 @@ using namespace boost::endian;
|
|||||||
struct X
|
struct X
|
||||||
{
|
{
|
||||||
big_uint16_buf_t a;
|
big_uint16_buf_t a;
|
||||||
double b;
|
native_float64_buf_t b;
|
||||||
little_uint16_buf_t c;
|
little_uint16_buf_t c;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_EQ( sizeof(big_uint16_buf_t), 2 );
|
BOOST_TEST_EQ( sizeof(big_uint16_buf_t), 2 );
|
||||||
BOOST_TEST_EQ( sizeof(double), 8 );
|
BOOST_TEST_EQ( sizeof(native_float64_buf_t), 8 );
|
||||||
BOOST_TEST_EQ( sizeof(little_uint16_buf_t), 2 );
|
BOOST_TEST_EQ( sizeof(little_uint16_buf_t), 2 );
|
||||||
|
|
||||||
BOOST_TEST_EQ( sizeof(X), 12 );
|
BOOST_TEST_EQ( sizeof(X), 12 );
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
|
Reference in New Issue
Block a user