Mercurial > mm7
changeset 1527:f0551cd4cbc9
Clean Math.
author | yoctozepto |
---|---|
date | Fri, 06 Sep 2013 09:29:12 +0200 |
parents | f47eab1a70d8 |
children | 270627b54ed4 |
files | Math.h |
diffstat | 1 files changed, 5 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/Math.h Thu Sep 05 18:05:50 2013 +0600 +++ b/Math.h Fri Sep 06 09:29:12 2013 +0200 @@ -1,11 +1,7 @@ #pragma once + #include <cassert> #include <limits> -#include <float.h> -#include <cmath> -#include <cstdlib> -#include <ciso646> - /* 186 */ #pragma pack(push, 1) @@ -28,26 +24,20 @@ }; #pragma pack(pop) - int fixpoint_sub0(int, int); int fixpoint_div(int, int); int fixpoint_mul(int, int); int fixpoint_from_float(float value); -#ifndef ROUNDING_EPSILON -#define ROUNDING_EPSILON 0.0000001 -#endif - - template <typename FloatType> -int bankersRounding( +inline int bankersRounding( const FloatType& value ) { assert("Method unsupported for this type" && false); return value; } -template<> static int bankersRounding<float>(const float& inValue) +template<> inline int bankersRounding<float>(const float& inValue) { union Cast { @@ -61,8 +51,7 @@ #pragma push_macro("max") #undef max - -template<> static int bankersRounding<double>(const double& inValue) +template<> inline int bankersRounding<double>(const double& inValue) { double maxValue = std::numeric_limits<int>::max(); assert(maxValue - 6755399441055744.0 >= inValue); @@ -75,8 +64,6 @@ c.d = inValue + 6755399441055744.0; return c.l; } - - #pragma pop_macro("max") -extern struct stru193_math *stru_5C6E00; \ No newline at end of file +extern struct stru193_math *stru_5C6E00;