Fix "int WrapIndex(const int ind, const int nbNodes)" for ind=-4 and nbNodes=4
* \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;
}
/*!