mirror of
https://github.com/boostorg/endian.git
synced 2025-07-30 04:27:24 +02:00
Fix alignment test for 32 bit Linux/macOS
This commit is contained in:
@ -17,11 +17,17 @@ template<class T> struct align
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T> struct align2
|
||||||
|
{
|
||||||
|
char _;
|
||||||
|
T v;
|
||||||
|
};
|
||||||
|
|
||||||
template<class T, class U> void test_buffer( U const & y, bool aligned )
|
template<class T, class U> void test_buffer( U const & y, bool aligned )
|
||||||
{
|
{
|
||||||
align<T> x( y );
|
align<T> x( y );
|
||||||
|
|
||||||
BOOST_TEST_EQ( sizeof(x), aligned? 2 * sizeof(U): 1 + sizeof(U) );
|
BOOST_TEST_EQ( sizeof(x), aligned? sizeof( align2<U> ): 1 + sizeof(U) );
|
||||||
|
|
||||||
BOOST_TEST_EQ( x.v.value(), y );
|
BOOST_TEST_EQ( x.v.value(), y );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user