1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
Description: use alignment-safe buffer handling.
Currently we are using assignment to copy the contents of a variable of
arbitrary type into a buffer, but this is not portable because the buffer
address may not be aligned. Use memcpy() instead, which should be
comparable performance ut alignment-safe.
Author: Steve Langasek <steve.langasek@ubuntu.com>
Bug-Debian: https://bugs.debian.org/892223
Index: seqan2-2.4.0+dfsg/include/seqan/basic/basic_stream.h
===================================================================
--- seqan2-2.4.0+dfsg.orig/include/seqan/basic/basic_stream.h
+++ seqan2-2.4.0+dfsg/include/seqan/basic/basic_stream.h
@@ -1200,7 +1200,8 @@
inline void
appendRawPodImpl(TTargetValue * &ptr, TValue const & val)
{
- *reinterpret_cast<TValue* &>(ptr)++ = val;
+ std::memcpy(ptr, &val, sizeof(TValue));
+ ptr += sizeof(TValue);
}
template <typename TTarget, typename TValue>
|