d3dx9_36: Replace powf(2, unsigned int) with (1u << unsigned int).
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
66f4015781
commit
1e78257109
|
@ -2138,21 +2138,21 @@ unsigned short float_32_to_16(const float in)
|
||||||
if (isnan(in)) return (sign ? 0xffff : 0x7fff);
|
if (isnan(in)) return (sign ? 0xffff : 0x7fff);
|
||||||
if (in == 0.0f) return (sign ? 0x8000 : 0x0000);
|
if (in == 0.0f) return (sign ? 0x8000 : 0x0000);
|
||||||
|
|
||||||
if (tmp < powf(2, 10))
|
if (tmp < (float)(1u << 10))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
tmp *= 2.0f;
|
tmp *= 2.0f;
|
||||||
exp--;
|
exp--;
|
||||||
} while (tmp < powf(2, 10));
|
} while (tmp < (float)(1u << 10));
|
||||||
}
|
}
|
||||||
else if (tmp >= powf(2, 11))
|
else if (tmp >= (float)(1u << 11))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
tmp /= 2.0f;
|
tmp /= 2.0f;
|
||||||
exp++;
|
exp++;
|
||||||
} while (tmp >= powf(2, 11));
|
} while (tmp >= (float)(1u << 11));
|
||||||
}
|
}
|
||||||
|
|
||||||
exp += 10; /* Normalize the mantissa */
|
exp += 10; /* Normalize the mantissa */
|
||||||
|
@ -2190,7 +2190,7 @@ unsigned short float_32_to_16(const float in)
|
||||||
exp = origexp;
|
exp = origexp;
|
||||||
|
|
||||||
/* the 13 extra bits from single precision are used for rounding */
|
/* 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 >>= 1 - exp; /* denormalize */
|
||||||
|
|
||||||
mantissa -= ~(mantissa >> 13) & 1; /* round half to even */
|
mantissa -= ~(mantissa >> 13) & 1; /* round half to even */
|
||||||
|
|
Loading…
Reference in New Issue