1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Clang: Fix build errors when using a recent clang-cl

This commit is contained in:
reuk 2020-06-29 11:54:41 +01:00
parent ab6c407b9f
commit ac2d7ee272
7 changed files with 15 additions and 7 deletions

View file

@ -521,7 +521,8 @@ template <typename FloatType>
unsigned int truncatePositiveToUnsignedInt (FloatType value) noexcept
{
jassert (value >= static_cast<FloatType> (0));
jassert (static_cast<FloatType> (value) <= std::numeric_limits<unsigned int>::max());
jassert (static_cast<FloatType> (value)
<= static_cast<FloatType> (std::numeric_limits<unsigned int>::max()));
return static_cast<unsigned int> (value);
}

View file

@ -105,7 +105,8 @@ bool Random::nextBool() noexcept
float Random::nextFloat() noexcept
{
auto result = static_cast<uint32> (nextInt()) / (std::numeric_limits<uint32>::max() + 1.0f);
auto result = static_cast<uint32> (nextInt())
/ (static_cast<float> (std::numeric_limits<uint32>::max()) + 1.0f);
return result == 1.0f ? 1.0f - std::numeric_limits<float>::epsilon() : result;
}