summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/shaders/fp-unpack-01.c5
-rw-r--r--tests/util/piglit-util.h18
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 <piglit/glut_wrap.h>
#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,