diff options
| author | Nolan Check <Nolan.Check@gmail.com> | 2009-07-28 07:40:18 +0000 |
|---|---|---|
| committer | Nolan Check <Nolan.Check@gmail.com> | 2009-07-28 07:40:18 +0000 |
| commit | 989e5b7798adc1da5f78225d8bc8ce53692af21e (patch) | |
| tree | 8b0ea058d468b18f34bd6cc3ce1c9e3e1cdde1c1 /Source/Core/Common/Src/MathUtil.cpp | |
| parent | 335a02b030bf985bab3eb8c19918b222fc0e1c7c (diff) | |
Decent C++ for MathFloatVectorSum.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3895 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/MathUtil.cpp')
| -rw-r--r-- | Source/Core/Common/Src/MathUtil.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Source/Core/Common/Src/MathUtil.cpp b/Source/Core/Common/Src/MathUtil.cpp index 0a967e9a3f..6a8e1bbd8c 100644 --- a/Source/Core/Common/Src/MathUtil.cpp +++ b/Source/Core/Common/Src/MathUtil.cpp @@ -19,6 +19,7 @@ #include "MathUtil.h" #include <cmath> +#include <numeric> namespace { @@ -160,14 +161,9 @@ inline void MatrixMul(int n, const float *a, const float *b, float *result) } // Calculate sum of a float list -float MathFloatVectorSum(std::vector<float> Vec) +float MathFloatVectorSum(const std::vector<float>& Vec) { - float Sum = 0.0; - for(unsigned i = 0; i < Vec.size(); i++) - { - Sum += Vec.at(i); - } - return Sum; + return std::accumulate(Vec.begin(), Vec.end(), 0.0f); } void Matrix33::LoadIdentity(Matrix33 &mtx) |
