diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 5233d42116..fdb2e3cec4 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -531,7 +531,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::split) auto* result = Array::create(global_object); size_t result_len = 0; - auto limit = static_cast(MAX_U32); + auto limit = NumericLimits::max(); if (!vm.argument(1).is_undefined()) { limit = vm.argument(1).to_u32(global_object); if (vm.exception()) diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index c59440c697..1f51f63b82 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -552,7 +552,7 @@ i32 Value::as_i32() const u32 Value::as_u32() const { VERIFY(as_double() >= 0); - return min((double)as_i32(), MAX_U32); + return min((u32)as_i32(), NumericLimits::max()); } double Value::to_double(GlobalObject& global_object) const diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index 6346909f62..8cc650db53 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -37,8 +37,6 @@ // 2 ** 53 - 1 static constexpr double MAX_ARRAY_LIKE_INDEX = 9007199254740991.0; -// 2 ** 32 - 1 -static constexpr double MAX_U32 = 4294967295.0; // Unique bit representation of negative zero (only sign bit set) static constexpr u64 NEGATIVE_ZERO_BITS = ((u64)1 << 63);