From 7f58bcf320258dd7e666a25ba2a122f2e7aaa658 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Tue, 14 Sep 2021 09:55:36 +0800 Subject: [PATCH] added PrimaryMathematics.h --- inc/hgl/math/Math.h | 1 + inc/hgl/math/PrimaryMathematics.h | 39 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 inc/hgl/math/PrimaryMathematics.h diff --git a/inc/hgl/math/Math.h b/inc/hgl/math/Math.h index 6637bfb..30fb8b4 100644 --- a/inc/hgl/math/Math.h +++ b/inc/hgl/math/Math.h @@ -1,6 +1,7 @@ #ifndef HGL_ALGORITHM_MATH_INCLUDE #define HGL_ALGORITHM_MATH_INCLUDE +#include #include #include // Game Math and Geometry Library #include diff --git a/inc/hgl/math/PrimaryMathematics.h b/inc/hgl/math/PrimaryMathematics.h new file mode 100644 index 0000000..c85ea01 --- /dev/null +++ b/inc/hgl/math/PrimaryMathematics.h @@ -0,0 +1,39 @@ +#ifndef HGL_Primary_Mathematics_INCLUDE +#define HGL_Primary_Mathematics_INCLUDE +namespace hgl +{ + /** + * ÇóÒ»ÅúÊýµÄºÏ + */ + template + const T sum(const T *data,const int count) + { + T result=0; + + for(int i=0;i + const R sum(const T *data,const int count) + { + R result=0; + + for(int i=0;i