1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:07:44 +00:00

LibJS: Replace MAX_U32 with NumericLimits<u32>::max()

This commit is contained in:
Linus Groh 2021-04-17 19:34:33 +02:00
parent 8e0beda13a
commit eedde500eb
3 changed files with 2 additions and 4 deletions

View file

@ -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<u32>(MAX_U32);
auto limit = NumericLimits<u32>::max();
if (!vm.argument(1).is_undefined()) {
limit = vm.argument(1).to_u32(global_object);
if (vm.exception())

View file

@ -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<u32>::max());
}
double Value::to_double(GlobalObject& global_object) const

View file

@ -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);