Skip to content

Commit 404c59a

Browse files
committed
Fixed flush cases for float11/float10 conversions
1 parent 55dddfe commit 404c59a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Inc/DirectXPackedVector.inl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,26 +2504,26 @@ inline void XM_CALLCONV XMStoreFloat3PK
25042504
if ((I & 0x7F800000) == 0x7F800000)
25052505
{
25062506
// INF or NAN
2507-
Result[j] = 0x7c0;
2507+
Result[j] = 0x7C0U;
25082508
if ((I & 0x7FFFFF) != 0)
25092509
{
2510-
Result[j] = 0x7c0 | (((I >> 17) | (I >> 11) | (I >> 6) | (I)) & 0x3f);
2510+
Result[j] = 0x7FFU;
25112511
}
25122512
else if (Sign)
25132513
{
25142514
// -INF is clamped to 0 since 3PK is positive only
25152515
Result[j] = 0;
25162516
}
25172517
}
2518-
else if (Sign)
2518+
else if (Sign || I < 0x35800000)
25192519
{
25202520
// 3PK is positive only, so clamp to zero
25212521
Result[j] = 0;
25222522
}
25232523
else if (I > 0x477E0000U)
25242524
{
25252525
// The number is too large to be represented as a float11, set to max
2526-
Result[j] = 0x7BF;
2526+
Result[j] = 0x7BFU;
25272527
}
25282528
else
25292529
{
@@ -2551,12 +2551,12 @@ inline void XM_CALLCONV XMStoreFloat3PK
25512551
if ((I & 0x7F800000) == 0x7F800000)
25522552
{
25532553
// INF or NAN
2554-
Result[2] = 0x3e0;
2554+
Result[2] = 0x3E0U;
25552555
if (I & 0x7FFFFF)
25562556
{
2557-
Result[2] = 0x3e0 | (((I >> 18) | (I >> 13) | (I >> 3) | (I)) & 0x1f);
2557+
Result[2] = 0x3FFU;
25582558
}
2559-
else if (Sign)
2559+
else if (Sign || I < 0x36000000)
25602560
{
25612561
// -INF is clamped to 0 since 3PK is positive only
25622562
Result[2] = 0;
@@ -2570,7 +2570,7 @@ inline void XM_CALLCONV XMStoreFloat3PK
25702570
else if (I > 0x477C0000U)
25712571
{
25722572
// The number is too large to be represented as a float10, set to max
2573-
Result[2] = 0x3df;
2573+
Result[2] = 0x3DFU;
25742574
}
25752575
else
25762576
{

0 commit comments

Comments
 (0)