aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/packetmath.cpp
diff options
context:
space:
mode:
authorGravatar Joel Holdsworth <joel.holdsworth@vcatechnology.com>2019-11-05 19:06:12 +0000
committerGravatar Joel Holdsworth <joel.holdsworth@vcatechnology.com>2019-11-05 19:06:12 +0000
commit743c92528639f466eb887655b5f0fa872105326a (patch)
treec65996646a64359f5b4f4226a0d7e69d46f0cd05 /test/packetmath.cpp
parentc79b6ffe1fcf8c12005942a1268f79b7d6ecf700 (diff)
test/packetmath: Silence alignment warnings
Diffstat (limited to 'test/packetmath.cpp')
-rw-r--r--test/packetmath.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/packetmath.cpp b/test/packetmath.cpp
index 64dd3dbf6..00f5f042b 100644
--- a/test/packetmath.cpp
+++ b/test/packetmath.cpp
@@ -39,9 +39,12 @@ bits(const T& x) {
// The following implement bitwise operations on floating point types
template<typename T,typename Bits,typename Func>
T apply_bit_op(Bits a, Bits b, Func f) {
- Array<unsigned char,sizeof(T),1> res;
- for(Index i=0; i<res.size();++i) res[i] = f(a[i],b[i]);
- return *reinterpret_cast<T*>(&res);
+ Array<unsigned char,sizeof(T),1> data;
+ T res;
+ for(Index i = 0; i < data.size(); ++i)
+ data[i] = f(a[i], b[i]);
+ std::memcpy(&res, &data, sizeof(T));
+ return res;
}
#define EIGEN_TEST_MAKE_BITWISE2(OP,FUNC,T) \