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:
parent
335a02b030
commit
989e5b7798
|
@ -19,6 +19,7 @@
|
||||||
#include "MathUtil.h"
|
#include "MathUtil.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <numeric>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -160,14 +161,9 @@ inline void MatrixMul(int n, const float *a, const float *b, float *result)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate sum of a float list
|
// Calculate sum of a float list
|
||||||
float MathFloatVectorSum(std::vector<float> Vec)
|
float MathFloatVectorSum(const std::vector<float>& Vec)
|
||||||
{
|
{
|
||||||
float Sum = 0.0;
|
return std::accumulate(Vec.begin(), Vec.end(), 0.0f);
|
||||||
for(unsigned i = 0; i < Vec.size(); i++)
|
|
||||||
{
|
|
||||||
Sum += Vec.at(i);
|
|
||||||
}
|
|
||||||
return Sum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix33::LoadIdentity(Matrix33 &mtx)
|
void Matrix33::LoadIdentity(Matrix33 &mtx)
|
||||||
|
|
|
@ -151,7 +151,7 @@ inline double pow2(double x) {return x * x;}
|
||||||
void SaveSSEState();
|
void SaveSSEState();
|
||||||
void LoadSSEState();
|
void LoadSSEState();
|
||||||
void LoadDefaultSSEState();
|
void LoadDefaultSSEState();
|
||||||
float MathFloatVectorSum(std::vector<float>);
|
float MathFloatVectorSum(const std::vector<float>&);
|
||||||
|
|
||||||
#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
|
#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue