mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Decent C++ for MathFloatVectorSum.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3895 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user