From 42b6bffbf2b6aa34f4f82cd4c3c34ed5528790ad Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 22 Jul 2021 18:48:48 +0100 Subject: [PATCH] AK: Make TypeBoundsChecker work By replacing MakeUnsigned 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. --- AK/Checked.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/Checked.h b/AK/Checked.h index fcdb50cec6c..bac072dfbec 100644 --- a/AK/Checked.h +++ b/AK/Checked.h @@ -58,7 +58,7 @@ template struct TypeBoundsChecker { static constexpr bool is_within_range(Source value) { - return static_cast>(value) <= NumericLimits::max(); + return value >= 0 && value <= NumericLimits::max(); } };