From fcf83e7908baffae4ffedd97f02faed544025289 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 21 Aug 2017 16:30:24 -0700 Subject: [PATCH] Fixed bug 3768 - provide a quick copysign() solution for watcom Ozkan Sezer The following patch provides a quick copysign solution for Watcom/x86 --- src/stdlib/SDL_stdlib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c index f3fa7d191dea7..194298d3c748b 100644 --- a/src/stdlib/SDL_stdlib.c +++ b/src/stdlib/SDL_stdlib.c @@ -109,6 +109,12 @@ SDL_copysign(double x, double y) return copysign(x, y); #elif defined(HAVE__COPYSIGN) return _copysign(x, y); +#elif defined(__WATCOMC__) && defined(__386__) + /* this is nasty as hell, but it works.. */ + unsigned int *xi = (unsigned int *) &x, + *yi = (unsigned int *) &y; + xi[1] = (yi[1] & 0x80000000) | (xi[1] & 0x7fffffff); + return x; #else return SDL_uclibc_copysign(x, y); #endif /* HAVE_COPYSIGN */