AK: Make TypeBoundsChecker<UnsignedIntegralT, FloatingPointT> work

By replacing MakeUnsigned<Source> in this specific specialization with a
simple negativity check this now works for floating point source types.
Previously it would attempt a comparison of the destination type and
void.
This commit is contained in:
Linus Groh 2021-07-22 18:48:48 +01:00
parent 8f26f51580
commit 42b6bffbf2

View file

@ -58,7 +58,7 @@ template<typename Destination, typename Source>
struct TypeBoundsChecker<Destination, Source, false, false, true> {
static constexpr bool is_within_range(Source value)
{
return static_cast<MakeUnsigned<Source>>(value) <= NumericLimits<Destination>::max();
return value >= 0 && value <= NumericLimits<Destination>::max();
}
};