forked from boostorg/endian
Add spirit_conflict_test.cpp (refs #33)
This commit is contained in:
@ -290,7 +290,7 @@ namespace endian
|
|||||||
{
|
{
|
||||||
T t;
|
T t;
|
||||||
std::memcpy( &t, bytes, sizeof(T) );
|
std::memcpy( &t, bytes, sizeof(T) );
|
||||||
return endian::big_to_native(t);
|
return boost::endian::big_to_native(t);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
return unrolled_byte_loops<T, n_bytes>::load_big
|
return unrolled_byte_loops<T, n_bytes>::load_big
|
||||||
@ -324,7 +324,7 @@ namespace endian
|
|||||||
// (the x86 architecture allows unaligned loads, but -fsanitize=undefined does not)
|
// (the x86 architecture allows unaligned loads, but -fsanitize=undefined does not)
|
||||||
if (sizeof(T) == n_bytes)
|
if (sizeof(T) == n_bytes)
|
||||||
{
|
{
|
||||||
endian::native_to_big_inplace(value);
|
boost::endian::native_to_big_inplace(value);
|
||||||
std::memcpy( bytes, &value, sizeof(T) );
|
std::memcpy( bytes, &value, sizeof(T) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -43,3 +43,5 @@ run conversion_test.cpp : : : <define>BOOST_ENDIAN_NO_INTRINSICS : conversion_te
|
|||||||
run intrinsic_test.cpp ;
|
run intrinsic_test.cpp ;
|
||||||
|
|
||||||
run quick.cpp ;
|
run quick.cpp ;
|
||||||
|
|
||||||
|
compile spirit_conflict_test.cpp ;
|
||||||
|
23
test/spirit_conflict_test.cpp
Normal file
23
test/spirit_conflict_test.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Copyright 2019 Peter Dimov
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# pragma warning( disable: 4510 ) // default constructor not generated
|
||||||
|
# pragma warning( disable: 4512 ) // assignment operator not generated
|
||||||
|
# pragma warning( disable: 4610 ) // class can never be instantiated
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/spirit/include/qi.hpp>
|
||||||
|
#include <boost/endian/arithmetic.hpp>
|
||||||
|
|
||||||
|
struct record
|
||||||
|
{
|
||||||
|
boost::endian::big_int16_t type;
|
||||||
|
|
||||||
|
record( boost::int16_t t )
|
||||||
|
{
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
};
|
Reference in New Issue
Block a user