in Inc/DirectXPackedVector.inl [1159:1270]
inline XMVECTOR XM_CALLCONV XMLoadFloat3PK(const XMFLOAT3PK* pSource) noexcept
{
assert(pSource);
XM_ALIGNED_DATA(16) uint32_t Result[4];
uint32_t Mantissa;
uint32_t Exponent;
// X Channel (6-bit mantissa)
Mantissa = pSource->xm;
if (pSource->xe == 0x1f) // INF or NAN
{
Result[0] = static_cast<uint32_t>(0x7f800000 | (static_cast<int>(pSource->xm) << 17));
}
else
{
if (pSource->xe != 0) // The value is normalized
{
Exponent = pSource->xe;
}
else if (Mantissa != 0) // The value is denormalized
{
// Normalize the value in the resulting float
Exponent = 1;
do
{
Exponent--;
Mantissa <<= 1;
} while ((Mantissa & 0x40) == 0);
Mantissa &= 0x3F;
}
else // The value is zero
{
Exponent = static_cast<uint32_t>(-112);
}
Result[0] = ((Exponent + 112) << 23) | (Mantissa << 17);
}
// Y Channel (6-bit mantissa)
Mantissa = pSource->ym;
if (pSource->ye == 0x1f) // INF or NAN
{
Result[1] = static_cast<uint32_t>(0x7f800000 | (static_cast<int>(pSource->ym) << 17));
}
else
{
if (pSource->ye != 0) // The value is normalized
{
Exponent = pSource->ye;
}
else if (Mantissa != 0) // The value is denormalized
{
// Normalize the value in the resulting float
Exponent = 1;
do
{
Exponent--;
Mantissa <<= 1;
} while ((Mantissa & 0x40) == 0);
Mantissa &= 0x3F;
}
else // The value is zero
{
Exponent = static_cast<uint32_t>(-112);
}
Result[1] = ((Exponent + 112) << 23) | (Mantissa << 17);
}
// Z Channel (5-bit mantissa)
Mantissa = pSource->zm;
if (pSource->ze == 0x1f) // INF or NAN
{
Result[2] = static_cast<uint32_t>(0x7f800000 | (static_cast<int>(pSource->zm) << 17));
}
else
{
if (pSource->ze != 0) // The value is normalized
{
Exponent = pSource->ze;
}
else if (Mantissa != 0) // The value is denormalized
{
// Normalize the value in the resulting float
Exponent = 1;
do
{
Exponent--;
Mantissa <<= 1;
} while ((Mantissa & 0x20) == 0);
Mantissa &= 0x1F;
}
else // The value is zero
{
Exponent = static_cast<uint32_t>(-112);
}
Result[2] = ((Exponent + 112) << 23) | (Mantissa << 18);
}
return XMLoadFloat3A(reinterpret_cast<const XMFLOAT3A*>(&Result));
}