forked from boostorg/endian
Use an unaligned type instead of double in packed_*_test
This commit is contained in:
1 parent
84f15c4fb2
commit
b0b9622ceb
2 files changed
+10
-4
No files matched your search
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,15 +20,16 @@ using namespace boost::endian;
|
||||
struct X
|
||||
{
|
||||
big_uint16_buf_t a;
|
||||
double b;
|
||||
native_float64_buf_t b;
|
||||
little_uint16_buf_t c;
|
||||
} __attribute__((packed));
|
||||
|
||||
int main()
|
||||
{
|
||||
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(X), 12 );
|
||||
|
||||
return boost::report_errors();
|
||||
|
||||
Reference in new issue
Block a user