From 09207eacfb3461ae6f3d519086eb4b731cdc34e5 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 27 Jul 2015 17:45:23 -0400 Subject: [PATCH] Eliminate use of 'memset' --- include/cantera/base/Array.h | 9 +-------- src/numerics/SquareMatrix.cpp | 11 +---------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/cantera/base/Array.h b/include/cantera/base/Array.h index 177b4ec6d..dcc2901dc 100644 --- a/include/cantera/base/Array.h +++ b/include/cantera/base/Array.h @@ -237,14 +237,7 @@ public: //! Set all of the entries to zero void zero() { - size_t nn = m_nrows * m_ncols; - if (nn > 0) { - /* - * Using memset is the fastest way to zero a contiguous - * section of memory. - */ - (void) memset((void*) &m_data[0], 0, nn * sizeof(doublereal)); - } + m_data.assign(m_data.size(), 0.0); } //! Allows setting elements using the syntax A(i,j) = x. diff --git a/src/numerics/SquareMatrix.cpp b/src/numerics/SquareMatrix.cpp index b35ab1f9b..36e6c1e4c 100644 --- a/src/numerics/SquareMatrix.cpp +++ b/src/numerics/SquareMatrix.cpp @@ -91,16 +91,7 @@ int SquareMatrix::solve(doublereal* b, size_t nrhs, size_t ldb) void SquareMatrix::zero() { - size_t n = nRows(); - if (n > 0) { - size_t nn = n * n; - double* sm = &m_data[0]; - /* - * Using memset is the fastest way to zero a contiguous - * section of memory. - */ - (void) memset((void*) sm, 0, nn * sizeof(double)); - } + m_data.assign(m_data.size(), 0.0); } void SquareMatrix::resize(size_t n, size_t m, doublereal v)