Use temporary variables to hold the result of BOOST_ENDIAN_INTRINSIC_*

This commit is contained in:
Peter Dimov
2018-12-06 18:48:43 +02:00
parent 84273c7139
commit de4aadcb11

View File

@ -18,13 +18,16 @@ int main()
#ifndef BOOST_ENDIAN_NO_INTRINSICS
uint16 x2 = 0x1122U;
BOOST_TEST_EQ( BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_2(x2), 0x2211U );
uint16 y2 = BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_2(x2);
BOOST_TEST_EQ( y2, 0x2211U );
uint32 x4 = 0x11223344UL;
BOOST_TEST_EQ( BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_4(x4), 0x44332211UL );
uint32 y4 = BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_4(x4);
BOOST_TEST_EQ( y4, 0x44332211UL );
uint64 x8 = 0x1122334455667788U;
BOOST_TEST_EQ( BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(x8), 0x8877665544332211ULL );
uint64 y8 = BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(x8);
BOOST_TEST_EQ( y8, 0x8877665544332211ULL );
#endif