Browse Source

LibJS: Make Value::as_u32() slightly less broken

Still a horrible mess, but at least it can actually return numbers > i32
max now.
Linus Groh 4 năm trước cách đây
mục cha
commit
47bd25a2f1
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      Userland/Libraries/LibJS/Runtime/Value.cpp

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Value.cpp

@@ -584,7 +584,7 @@ i32 Value::as_i32() const
 u32 Value::as_u32() const
 {
     VERIFY(as_double() >= 0);
-    return min((u32)as_i32(), NumericLimits<u32>::max());
+    return (u32)min(as_double(), (double)NumericLimits<u32>::max());
 }
 
 double Value::to_double(GlobalObject& global_object) const