d3dx9_36: Use copysignf() instead of signbit().

Francois Gouget fgouget at codeweavers.com
Tue Jul 12 07:23:38 CDT 2011


This fixes compilation on Solaris 10u9 with the Sun issued gcc 3.4.3.
---

Hopefully this won't have any impact on performance or this code is not 
performance critical. If not I can also provide a version that keeps the 
HAVE_SIGNBIT check but tests for it directly in the function.

 dlls/d3dx9_36/math.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index f13f2fb..4c03e95 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -1776,11 +1776,12 @@ static inline unsigned short float_32_to_16(const float in)
 {
     int exp = 0, origexp;
     float tmp = fabs(in);
-    int sign = signbit(in);
+    int sign;
     unsigned int mantissa;
     unsigned short ret;
 
     /* Deal with special numbers */
+    sign = (copysignf(1, in) < 0);
     if (isinf(in)) return (sign ? 0xffff : 0x7fff);
     if (isnan(in)) return (sign ? 0xffff : 0x7fff);
     if (in == 0.0f) return (sign ? 0x8000 : 0x0000);
-- 
1.7.5.4



More information about the wine-patches mailing list