mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Port Ceres to Windows
This is a preliminary, but full, port of Ceres to Windows. Currently all tests compile and run, with only system_test failing to work correctly due to a path issue. Change-Id: I4152c1588bf51ffd7f4d9401ef9759f5d28c299c
This commit is contained in:
@@ -37,12 +37,28 @@
|
||||
#ifndef CERES_PUBLIC_FPCLASSIFY_H_
|
||||
#define CERES_PUBLIC_FPCLASSIFY_H_
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <float.h>
|
||||
#endif
|
||||
|
||||
namespace ceres {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
inline bool IsFinite (double x) { return _finite(x); }
|
||||
inline bool IsInfinite(double x) { return !_finite(x) && !_isnan(x); }
|
||||
inline bool IsNaN (double x) { return _isnan(x); }
|
||||
inline bool IsNormal (double x) {
|
||||
int classification = _fpclass(x);
|
||||
return classification == _FPCLASS_NN ||
|
||||
classification == _FPCLASS_PN;
|
||||
}
|
||||
#else
|
||||
// TODO(keir): Test the "else" with more platforms.
|
||||
inline bool IsFinite (double x) { return std::isfinite(x); }
|
||||
inline bool IsInfinite(double x) { return std::isinf(x); }
|
||||
inline bool IsNaN (double x) { return std::isnan(x); }
|
||||
inline bool IsNormal (double x) { return std::isnormal(x); }
|
||||
#endif
|
||||
|
||||
} // namespace ceres
|
||||
|
||||
|
||||
Reference in New Issue
Block a user