mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 06:01:17 +02:00
- Check for packaged streflop and use it before using embedded copy
This commit is contained in:
73
source/shared_lib/include/platform/common/streflop_cond.h
Normal file
73
source/shared_lib/include/platform/common/streflop_cond.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* Copyright (C) 2008 Tobi Vollebregt
|
||||
2010 Mark Vejvoda
|
||||
|
||||
You can redistribute this code and/or modify it under
|
||||
the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version
|
||||
==============================================================
|
||||
*/
|
||||
|
||||
/* Conditionally include streflop depending on STREFLOP_* #defines:
|
||||
If one of those is present, #include "streflop.h", otherwise #include <math.h>
|
||||
|
||||
When faced with ambiguous call errors with e.g. fabs, use math::function.
|
||||
Add it to math namespace if it doesn't exist there yet. */
|
||||
|
||||
#ifndef STREFLOP_COND_H
|
||||
#define STREFLOP_COND_H
|
||||
|
||||
#if defined(STREFLOP_X87) || defined(STREFLOP_SSE) || defined(STREFLOP_SOFT)
|
||||
#include <streflop.h>
|
||||
using namespace streflop;
|
||||
|
||||
namespace math {
|
||||
using namespace streflop;
|
||||
}
|
||||
#else
|
||||
#include <cmath>
|
||||
namespace math {
|
||||
using std::fabs;
|
||||
// using std::sqrt;
|
||||
using std::sin;
|
||||
using std::cos;
|
||||
|
||||
using std::sinh;
|
||||
using std::cosh;
|
||||
using std::tan;
|
||||
using std::tanh;
|
||||
using std::asin;
|
||||
using std::acos;
|
||||
using std::atan;
|
||||
using std::atan2;
|
||||
using std::ceil;
|
||||
using std::floor;
|
||||
using std::fmod;
|
||||
using std::pow;
|
||||
using std::log;
|
||||
using std::log10;
|
||||
using std::exp;
|
||||
using std::frexp;
|
||||
using std::ldexp;
|
||||
// the following are C99 functions -> not supported by VS C
|
||||
#if !defined(_MSC_VER) || _MSC_VER < 1500
|
||||
using std::isnan;
|
||||
using std::isinf;
|
||||
using std::isfinite;
|
||||
#elif __cplusplus
|
||||
template<typename T> inline bool isnan(T value) {
|
||||
return value != value;
|
||||
}
|
||||
// requires include <limits>
|
||||
template<typename T> inline bool isinf(T value) {
|
||||
return std::numeric_limits<T>::has_infinity && value == std::numeric_limits<T>::infinity();
|
||||
}
|
||||
// requires include <limits>
|
||||
template<typename T> inline bool isfinite(T value) {
|
||||
return !isinf<T>(value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // STREFLOP_COND_H
|
Reference in New Issue
Block a user