We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3768 - provide a quick copysign() solution for watcom
Summary: provide a quick copysign() solution for watcom
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: x86 All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-21 23:06 UTC by Ozkan Sezer
Modified: 2017-08-21 23:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2017-08-21 23:06:53 UTC
The following patch provides a quick copysign solution for Watcom/x86

----

diff -r 23000b73ce4e src/stdlib/SDL_stdlib.c
--- 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 */
Comment 1 Sam Lantinga 2017-08-21 23:30:44 UTC
Added!
https://hg.libsdl.org/SDL/rev/8b3231952c22