From 303797b44f0c4121e7d096a1d7b634e267dbead6 Mon Sep 17 00:00:00 2001 From: Marco Biasini <marco.biasini@unibas.ch> Date: Wed, 13 Apr 2011 07:19:56 +0200 Subject: [PATCH] silence strict aliasing warning --- modules/geom/src/vec3.cc | 4 ++-- modules/mol/alg/src/superpose_frames.cc | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/geom/src/vec3.cc b/modules/geom/src/vec3.cc index a21d150d6..84467ced5 100644 --- a/modules/geom/src/vec3.cc +++ b/modules/geom/src/vec3.cc @@ -48,11 +48,11 @@ Mat3 Vec3List::GetInertia() const Mat3 Vec3List::GetPrincipalAxes() const { Mat3 inertia=this->GetInertia(); - EMat3 inertia_mat(*reinterpret_cast<EMat3*>(&inertia)); + EMat3 inertia_mat(inertia.Data()); Eigen::SVD<EMat3> svd(inertia_mat); EMat3 rot=svd.matrixU(); - Mat3 axes(*reinterpret_cast<Mat3*>(&rot)); + Mat3 axes(rot.data()); return axes; } diff --git a/modules/mol/alg/src/superpose_frames.cc b/modules/mol/alg/src/superpose_frames.cc index defe8a324..aafec9d78 100644 --- a/modules/mol/alg/src/superpose_frames.cc +++ b/modules/mol/alg/src/superpose_frames.cc @@ -35,26 +35,26 @@ typedef Eigen::Matrix<Real, Eigen::Dynamic, 3> EMatX3; inline geom::Vec3 rvec_to_gvec(const ERVec3 &vec) { - return *reinterpret_cast<const geom::Vec3*>(&vec); + return geom::Vec3(vec.data()); } inline geom::Vec3 cvec_to_gvec(const ECVec3 &vec) { - return *reinterpret_cast<const geom::Vec3*>(&vec); + return geom::Vec3(vec.data()); } inline geom::Mat3 emat_to_gmat(const EMat3 &mat) { - return *reinterpret_cast<const geom::Mat3*>(&mat); + return geom::Mat3(mat.data()); } inline ERVec3 gvec_to_rvec(const geom::Vec3 &vec) { - return *reinterpret_cast<const ERVec3*>(&vec); + return ERVec3(&vec[0]); } inline ECVec3 gvec_to_cvec(const geom::Vec3 &vec) { - return *reinterpret_cast<const ECVec3*>(&vec); + return ECVec3(&vec[0]); } inline EMat3X row_sub(const EMat3X& m, const ERVec3& s) -- GitLab