Commit 8ee4ba9f authored by Christian Forfang's avatar Christian Forfang

round(...) is defined in Visual C++ 2013; added as exception to preprocessor fix

parent 20d7320c
......@@ -42,10 +42,7 @@
#include <Glut/glut.h>
#elif defined(_WIN32) || defined(_WIN64)
#include <GLUT/glut.h>
// Round and INFINITY only defined in C99
double round(double r) {
return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
}
// INFINITY only defined in C99
#define INFINITY 99999999999
#else
#include <GL/glut.h>
......
......@@ -38,10 +38,12 @@
#include <math.h>
double round (float v)
#if !defined(_MSC_VER) || _MSC_VER < 1800
double round (double v)
{
return floor(v+0.5f);
return (v > 0.0) ? floor(v + 0.5) : ceil(v - 0.5);
}
#endif // _MSC_VER < 1800
// strndup() is not available on Windows
char *strndup( const char *s1, size_t n)
......
......@@ -58,7 +58,9 @@ extern "C" {
#elif defined(_WIN32) || defined(_WIN64)
/* does not exist on windows */
char * strndup( const char *s1, size_t n);
double round (float v);
# if !defined(_MSC_VER) || _MSC_VER < 1800
double round(double v);
# endif // _MSC_VER
# pragma warning (disable: 4244) // suspend warnings
#endif // _WIN32 || _WIN64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment