=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3dx9_36: Replace powf(2, unsigned int) with (1u << unsigned int).

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 25 10:11:19 CST 2015


Module: wine
Branch: master
Commit: 1e7825710964d3c654815c780cd09e21e114a580
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e7825710964d3c654815c780cd09e21e114a580

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sun Nov 22 01:00:57 2015 +0100

d3dx9_36: Replace powf(2, unsigned int) with (1u << unsigned int).

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/math.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index 09c055e..5e8d51a 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -2138,21 +2138,21 @@ unsigned short float_32_to_16(const float in)
     if (isnan(in)) return (sign ? 0xffff : 0x7fff);
     if (in == 0.0f) return (sign ? 0x8000 : 0x0000);
 
-    if (tmp < powf(2, 10))
+    if (tmp < (float)(1u << 10))
     {
         do
         {
             tmp *= 2.0f;
             exp--;
-        } while (tmp < powf(2, 10));
+        } while (tmp < (float)(1u << 10));
     }
-    else if (tmp >= powf(2, 11))
+    else if (tmp >= (float)(1u << 11))
     {
         do
         {
             tmp /= 2.0f;
             exp++;
-        } while (tmp >= powf(2, 11));
+        } while (tmp >= (float)(1u << 11));
     }
 
     exp += 10;  /* Normalize the mantissa */
@@ -2190,7 +2190,7 @@ unsigned short float_32_to_16(const float in)
         exp = origexp;
 
         /* the 13 extra bits from single precision are used for rounding */
-        mantissa = (unsigned int)(tmp * powf(2, 13));
+        mantissa = (unsigned int)(tmp * (1u << 13));
         mantissa >>= 1 - exp; /* denormalize */
 
         mantissa -= ~(mantissa >> 13) & 1; /* round half to even */




More information about the wine-cvs mailing list