From 0280d2e6a7e4bc637f847f7529b775941d429b38 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 22 Nov 2013 12:34:45 +0000 Subject: [PATCH] 22361: EDF SMESH: Quadrangle (mapping) algorithm: faces with more than 4 edges Fix "int WrapIndex(const int ind, const int nbNodes)" for ind=-4 and nbNodes=4 --- src/SMESH/SMESH_MesherHelper.hxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index 0073e0881..bfe44f75a 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -140,10 +140,8 @@ class SMESH_EXPORT SMESH_MesherHelper * \param nbNodes - total nb of nodes * \retval int - valid node index */ - static int WrapIndex(const int ind, const int nbNodes) { - if ( ind < 0 ) return nbNodes + ind % nbNodes; - if ( ind >= nbNodes ) return ind % nbNodes; - return ind; + static inline int WrapIndex(int ind, const int nbNodes) { + return (( ind %= nbNodes ) < 0 ) ? ind + nbNodes : ind; } /*! -- 2.39.2