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:
parent
8e0beda13a
commit
eedde500eb
3 changed files with 2 additions and 4 deletions
|
@ -531,7 +531,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::split)
|
||||||
auto* result = Array::create(global_object);
|
auto* result = Array::create(global_object);
|
||||||
size_t result_len = 0;
|
size_t result_len = 0;
|
||||||
|
|
||||||
auto limit = static_cast<u32>(MAX_U32);
|
auto limit = NumericLimits<u32>::max();
|
||||||
if (!vm.argument(1).is_undefined()) {
|
if (!vm.argument(1).is_undefined()) {
|
||||||
limit = vm.argument(1).to_u32(global_object);
|
limit = vm.argument(1).to_u32(global_object);
|
||||||
if (vm.exception())
|
if (vm.exception())
|
||||||
|
|
|
@ -552,7 +552,7 @@ i32 Value::as_i32() const
|
||||||
u32 Value::as_u32() const
|
u32 Value::as_u32() const
|
||||||
{
|
{
|
||||||
VERIFY(as_double() >= 0);
|
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
|
double Value::to_double(GlobalObject& global_object) const
|
||||||
|
|
|
@ -37,8 +37,6 @@
|
||||||
|
|
||||||
// 2 ** 53 - 1
|
// 2 ** 53 - 1
|
||||||
static constexpr double MAX_ARRAY_LIKE_INDEX = 9007199254740991.0;
|
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)
|
// Unique bit representation of negative zero (only sign bit set)
|
||||||
static constexpr u64 NEGATIVE_ZERO_BITS = ((u64)1 << 63);
|
static constexpr u64 NEGATIVE_ZERO_BITS = ((u64)1 << 63);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue