#include <boost/utility/enable_if.hpp>
#include <boost/throw_exception.hpp>
#include <boost/iterator/iterator_traits.hpp>
+#include <cstring> // for std::memcpy
namespace boost { namespace spirit { namespace detail
{
inline short fast_string::tag() const
{
- return (int(buff[small_string_size-2]) << 8) + (unsigned char)buff[small_string_size-1];
+ boost::int16_t tmp;
+ std::memcpy(&tmp, &buff[small_string_size-2], sizeof(tmp));
+ return tmp;
}
inline void fast_string::tag(short tag)
{
- buff[small_string_size-2] = tag >> 8;
- buff[small_string_size-1] = tag & 0xff;
+ boost::int16_t tmp = tag;
+ std::memcpy(&buff[small_string_size-2], &tmp, sizeof(tmp));
}
inline bool fast_string::is_heap_allocated() const
return *this;
}
- inline utree& utree::operator=(any_ptr const& p)
+ inline utree& utree::operator=(any_ptr const& p_)
{
free();
- v.p = p.p;
- v.i = p.i;
+ v.p = p_.p;
+ v.i = p_.i;
set_type(type::any_type);
return *this;
}