Skip to content

Commit

Permalink
fix Clang warning about inexact conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbaug committed Feb 7, 2024
1 parent eccdeb5 commit d9e01b4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test_conformance/spirv_new/test_decorate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,15 +482,18 @@ template <typename Ti, typename To> static inline To round_to_neginf(Ti in)
template <typename Ti, typename To>
static inline Ti generate_fprounding_input(RandomSeed &seed)
{
constexpr auto minVal = std::numeric_limits<To>::min() / 2;
constexpr auto maxVal = std::numeric_limits<To>::max() / 2;

if (std::is_same<cl_half, Ti>::value)
{
constexpr auto minVal =
static_cast<cl_float>(std::numeric_limits<To>::min() / 2);
constexpr auto maxVal =
static_cast<cl_float>(std::numeric_limits<To>::max() / 2);
cl_float f = genrandReal_range<cl_float>(minVal, maxVal, seed);
return cl_half_from_float(f, CL_HALF_RTE);
}

constexpr auto minVal = static_cast<Ti>(std::numeric_limits<To>::min() / 2);
constexpr auto maxVal = static_cast<Ti>(std::numeric_limits<To>::max() / 2);
return genrandReal_range<Ti>(minVal, maxVal, seed);
}

Expand Down

0 comments on commit d9e01b4

Please sign in to comment.