diff options
author | Linus Groh <mail@linusgroh.de> | 2021-07-06 16:45:04 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-06 17:29:12 +0100 |
commit | 47bd25a2f15b2f4c9b27a149f4452f21330cdbbe (patch) | |
tree | 43cf4f40e1780caa8b85b11a65bde7ef1f2c84ff /Userland/Libraries | |
parent | 30fe0529bdebdb13b3e11a83e7d2561e9534de79 (diff) | |
download | serenity-47bd25a2f15b2f4c9b27a149f4452f21330cdbbe.zip |
LibJS: Make Value::as_u32() slightly less broken
Still a horrible mess, but at least it can actually return numbers > i32
max now.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Value.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index a8398034e2..6b5a6a08f8 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/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 |