remove unused code that causes warnings

This commit is contained in:
Mathias Agopian
2021-01-15 14:38:01 -08:00
committed by Mathias Agopian
parent 410ecfd014
commit af82aaa0fc
2 changed files with 1 additions and 30 deletions
-7
View File
@@ -145,11 +145,6 @@ struct StdExp2dot2Log {
float operator()(float v) { return std::exp(2.2f * std::log(v)); }
static const char* label() { return "std::exp(2.2f * std::log(x))"; }
};
struct FastPow2dot2 {
using result_type = float;
float operator()(float v) { return fast::pow2dot2(v); }
static const char* label() { return "fast::pow2dot2"; }
};
struct Float16 {
using result_type = half;
@@ -176,7 +171,5 @@ BENCHMARK_TEMPLATE(BM_func, Vector, FastISqrt);
BENCHMARK_TEMPLATE(BM_func, Scalar, StdPow2dot2);
BENCHMARK_TEMPLATE(BM_func, Scalar, StdExp2dot2Log);
BENCHMARK_TEMPLATE(BM_func, Scalar, FastPow2dot2);
BENCHMARK_TEMPLATE(BM_func, Vector, FastPow2dot2);
BENCHMARK_TEMPLATE(BM_func, Scalar, Float16);
+1 -23
View File
@@ -57,7 +57,7 @@ constexpr inline float MATH_PURE ilog2(float x) noexcept {
float val;
int32_t x;
} u = { x };
return ((u.x >> 23) & 0xff) - 127;
return float(((u.x >> 23) & 0xff) - 127);
}
constexpr inline float MATH_PURE log2(float x) noexcept {
@@ -122,28 +122,6 @@ constexpr float exp(float x) noexcept {
return float(exp(double(x)));
}
inline float MATH_PURE pow(float a, float b) noexcept {
constexpr int fudgeMinRMSE = 486411;
constexpr int K = (127 << 23) - fudgeMinRMSE;
union {
float f;
int x;
} u = { a };
u.x = (int)(b * (u.x - K) + K);
return u.f;
}
// this is more precise than pow() above
inline float MATH_PURE pow2dot2(float a) noexcept {
union {
float f;
int x;
} u = { a };
constexpr int K = (127 << 23);
u.x = (int)(0.2f * (u.x - K) + K);
return a * a * u.f; // a^2 * a^0.2
}
/*
* unsigned saturated arithmetic
*/