From: Bart Van Assche Date: Thu, 28 Jul 2011 17:40:49 +0000 (+0000) Subject: Micro-optimize the matinv regression test X-Git-Tag: svn/VALGRIND_3_7_0~307 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f396bddd5ce03485f969993a78c82f1ff6ee6232;p=thirdparty%2Fvalgrind.git Micro-optimize the matinv regression test git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11930 --- diff --git a/drd/tests/matinv.c b/drd/tests/matinv.c index efcb02a7c6..1e2608850a 100644 --- a/drd/tests/matinv.c +++ b/drd/tests/matinv.c @@ -173,6 +173,7 @@ static void gj_threadfunc(struct gj_threadinfo* p) elem_t* const a = p->a; const int rows = p->rows; const int cols = p->cols; + elem_t aii; for (i = 0; i < p->rows; i++) { @@ -197,13 +198,10 @@ static void gj_threadfunc(struct gj_threadinfo* p) } } // Normalize row i. - if (a[i * cols + i] != 0) - { - for (k = cols - 1; k >= 0; k--) - { - a[i * cols + k] /= a[i * cols + i]; - } - } + aii = a[i * cols + i]; + if (aii != 0) + for (k = i; k < cols; k++) + a[i * cols + k] /= aii; } pthread_barrier_wait(p->b); // Reduce all rows j != i.