From 094cfb27dfe60f3f4ba0785c0896e4be3e08b31c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 16 Aug 2011 15:10:57 +0100 Subject: select,fp-unpack-01: Define round() & roundf() for MSVC in a single place. Should fix MSVC build. --- tests/shaders/fp-unpack-01.c | 5 ----- tests/util/piglit-util.h | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/shaders/fp-unpack-01.c b/tests/shaders/fp-unpack-01.c index 457b4868..fefb2691 100644 --- a/tests/shaders/fp-unpack-01.c +++ b/tests/shaders/fp-unpack-01.c @@ -90,11 +90,6 @@ static GLint progs[ELEMENTS(types)]; /*@}*/ -double round(double x) { - return floor(x + 0.5); -} - - void generate_shader(GLenum type) { diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h index 0f6b12e8..015f960b 100644 --- a/tests/util/piglit-util.h +++ b/tests/util/piglit-util.h @@ -53,12 +53,26 @@ typedef unsigned __int64 uint64_t; #include #if defined(_MSC_VER) + #define snprintf sprintf_s +static __inline double +round(double x) { + return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5); +} + +static __inline float +roundf(float x) { + return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f); +} + #define piglit_get_proc_address(x) wglGetProcAddress(x) -#else + +#else /* !defined(_MSC_VER) */ + #define piglit_get_proc_address(x) glutGetProcAddress(x) -#endif + +#endif /* !defined(_MSC_VER) */ enum piglit_result { PIGLIT_PASS, -- cgit v1.2.3