diff options
author | José Fonseca <jfonseca@vmware.com> | 2011-08-16 15:10:57 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2011-08-16 15:10:57 +0100 |
commit | 094cfb27dfe60f3f4ba0785c0896e4be3e08b31c (patch) | |
tree | e12042eef1281aa501facacae27d2aa4a309c4c9 /tests | |
parent | 2a626860b74345335f33c055db357e35c5d4ea14 (diff) |
select,fp-unpack-01: Define round() & roundf() for MSVC in a single place.
Should fix MSVC build.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/shaders/fp-unpack-01.c | 5 | ||||
-rw-r--r-- | 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 <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, |