Skip to content

Commit c0ad7a5

Browse files
committed
Can use std functions
1 parent 08b8ecd commit c0ad7a5

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

include/dxc/Test/HlslTestUtils.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,6 @@ static const uint16_t Float16NegDenorm = 0x8008;
527527
static const uint16_t Float16PosZero = 0x0000;
528528
static const uint16_t Float16NegZero = 0x8000;
529529

530-
inline bool IsInfFloat16(uint16_t val) {
531-
return (val == Float16PosInf) || (val == Float16NegInf);
532-
}
533-
534530
inline bool GetSign(float x) { return std::signbit(x); }
535531

536532
inline int GetMantissa(float x) {

tools/clang/unittests/HLSLExec/LongVectorTestData.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <DirectXMath.h>
1313
#include <DirectXPackedVector.h>
1414

15+
#include "dxc/Support/Global.h"
16+
1517
namespace LongVector {
1618

1719
// A helper struct because C++ bools are 1 byte and HLSL bools are 4 bytes.
@@ -119,8 +121,8 @@ struct HLSLHalf_t {
119121
HLSLHalf_t(DirectX::PackedVector::HALF) = delete;
120122

121123
static double GetULP(HLSLHalf_t A) {
122-
DXASSERT(!IsInfFloat16(A.Val), "ULP of infinity is undefined");
123-
DXASSERT(!IsNanFloat16(A.Val), "ULP of NaN is undefined");
124+
DXASSERT(!std::isnan(A) && !std::isinf(A),
125+
"ULP of NaN or infinity is undefined");
124126

125127
HLSLHalf_t Next = A;
126128
++Next.Val;

0 commit comments

Comments
 (0)