File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
include/nbl/builtin/hlsl/cpp_compat/impl Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change 16
16
#include <boost/preprocessor/punctuation/comma_if.hpp>
17
17
#include <boost/preprocessor/seq/for_each_i.hpp>
18
18
19
+
19
20
namespace nbl
20
21
{
21
22
namespace hlsl
@@ -538,12 +539,8 @@ struct nMin_helper<T>
538
539
using return_t = T;
539
540
static inline return_t __call (const T a, const T b)
540
541
{
541
- if (std::isnan (a))
542
- return b;
543
- if (std::isnan (b))
544
- return a;
545
-
546
- return std::min (a, b);
542
+ // comparison involving any NaN always returns false
543
+ return (b < a || std::isnan (a)) ? b : a;
547
544
}
548
545
};
549
546
@@ -554,12 +551,8 @@ struct nMax_helper<T>
554
551
using return_t = T;
555
552
static inline return_t __call (const T a, const T b)
556
553
{
557
- if (std::isnan (a))
558
- return b;
559
- if (std::isnan (b))
560
- return a;
561
-
562
- return std::max (a, b);
554
+ // comparison involving any NaN always returns false
555
+ return (a < b || std::isnan (a)) ? b : a;
563
556
}
564
557
};
565
558
You can’t perform that action at this time.
0 commit comments