From 6808fe0af642b4b0c72e44aa70c2eba777b359b4 Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Mon, 31 Mar 2014 18:11:33 +0200 Subject: [PATCH] Re-use gmx_greatest_common_divisor() Change-Id: Iee3a7b3bc339639360eed3498769efe64dd7dbf8 --- src/gromacs/gmxana/gmx_tune_pme.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/gromacs/gmxana/gmx_tune_pme.c b/src/gromacs/gmxana/gmx_tune_pme.c index 631c94c826..681a99033d 100644 --- a/src/gromacs/gmxana/gmx_tune_pme.c +++ b/src/gromacs/gmxana/gmx_tune_pme.c @@ -61,6 +61,7 @@ #include "perf_est.h" #include "inputrec.h" #include "gromacs/timing/walltime_accounting.h" +#include "gromacs/math/utilities.h" /* Enum for situations that can occur during log file parsing, the @@ -1170,22 +1171,6 @@ static void cleanup(const t_filenm *fnm, int nfile, int k, int nnodes, } -/* Returns the largest common factor of n1 and n2 */ -static int largest_common_factor(int n1, int n2) -{ - int factor, nmax; - - nmax = min(n1, n2); - for (factor = nmax; factor > 0; factor--) - { - if (0 == (n1 % factor) && 0 == (n2 % factor) ) - { - return(factor); - } - } - return 0; /* one for the compiler */ -} - enum { eNpmeAuto, eNpmeAll, eNpmeReduced, eNpmeSubset, eNpmeNr }; @@ -1272,7 +1257,7 @@ static void make_npme_list( gmx_fatal(FARGS, "Unknown option for eNPME in make_npme_list"); break; } - if (largest_common_factor(npp, npme) >= min_factor) + if (gmx_greatest_common_divisor(npp, npme) >= min_factor) { (*nPMEnodes)[nlist] = npme; nlist++; -- 2.22.0