Fix tst_qtendian autotest build for WEC7.
MSVC2008 compiler fo ARM targets fail to compile qToUnaligned when using sizeof(T) inside memcpy fynction. The compiler fails at least when the code is reached through the following macros and templates: -> tst_QtEndian::toLittleEndian -> qToLittleEndian(T src, uchar *dest) -> qToUnaligned(const T src, uchar *dest) The above sequence produces internal compiler error with MSVC2008/ARM builds when called from tst_endian. As a workaround sizeof(T) is called outside memcpy function. Change-Id: Ib4d382c2cebecb6e54bb99fc8fad72db93825fcd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
parent
de3d449dcf
commit
20d08a96c8
@ -78,7 +78,10 @@ template <typename T> inline void qbswap(const T src, uchar *dest)
|
||||
// If you want to avoid the memcopy, you must write specializations for this function
|
||||
template <typename T> inline void qToUnaligned(const T src, uchar *dest)
|
||||
{
|
||||
memcpy(dest, &src, sizeof(T));
|
||||
// Using sizeof(T) inside memcpy function produces internal compiler error with
|
||||
// MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T.
|
||||
const size_t size = sizeof(T);
|
||||
memcpy(dest, &src, size);
|
||||
}
|
||||
|
||||
/* T qFromLittleEndian(const uchar *src)
|
||||
|
Loading…
Reference in New Issue
Block a user