From 83b0ad2d642f4591163af0e2b83debe8b0ccb033 Mon Sep 17 00:00:00 2001 From: Giacomo Fiorin Date: Tue, 18 Jul 2023 10:09:29 -0400 Subject: [PATCH] Cast to bool when testing value of enum class flag --- src/colvar_rotation_derivative.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/colvar_rotation_derivative.h b/src/colvar_rotation_derivative.h index a12786af2..162067536 100644 --- a/src/colvar_rotation_derivative.h +++ b/src/colvar_rotation_derivative.h @@ -37,10 +37,10 @@ inline constexpr rotation_derivative_dldq operator|(rotation_derivative_dldq Lhs static_cast::type>(Rhs)); } -inline constexpr rotation_derivative_dldq operator&(rotation_derivative_dldq Lhs, rotation_derivative_dldq Rhs) { - return static_cast( - static_cast::type>(Lhs) & - static_cast::type>(Rhs)); +inline constexpr bool operator&(rotation_derivative_dldq Lhs, rotation_derivative_dldq Rhs) +{ + return (static_cast::type>(Lhs) & + static_cast::type>(Rhs)); } /// \brief Helper class for calculating the derivative of rotation @@ -79,7 +79,7 @@ struct rotation_derivative { * with respect to atoms. */ void prepare_derivative(rotation_derivative_dldq require_dl_dq) { - if (static_cast::type>(require_dl_dq & rotation_derivative_dldq::use_dl)) { + if (require_dl_dq & rotation_derivative_dldq::use_dl) { const auto &Q0 = m_rot.S_eigvec[0].data; tmp_Q0Q0[0][0] = Q0[0] * Q0[0]; tmp_Q0Q0[0][1] = Q0[0] * Q0[1]; @@ -98,7 +98,7 @@ struct rotation_derivative { tmp_Q0Q0[3][2] = Q0[3] * Q0[2]; tmp_Q0Q0[3][3] = Q0[3] * Q0[3]; } - if (static_cast::type>(require_dl_dq & rotation_derivative_dldq::use_dq)) { + if (require_dl_dq & rotation_derivative_dldq::use_dq) { const auto &Q0 = m_rot.S_eigvec[0].data; const auto &Q1 = m_rot.S_eigvec[1].data; const auto &Q2 = m_rot.S_eigvec[2].data;