Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index c5faed86ee98228f863825674ed14900e357236c..4adab80466650414cd4a3fb8ca61ac947c87fa51 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -18155,15 +18155,19 @@ RawInteger* Integer::New(int64_t value, Heap::Space space) { |
| } |
| RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) { |
| - if (value > static_cast<uint64_t>(Mint::kMaxValue)) { |
| - if (FLAG_limit_ints_to_64_bits) { |
| - // Out of range. |
| - return Integer::null(); |
| - } else { |
| - return Bigint::NewFromUint64(value, space); |
| - } |
| + if (!FLAG_limit_ints_to_64_bits && |
| + (value > static_cast<uint64_t>(Mint::kMaxValue))) { |
| + return Bigint::NewFromUint64(value, space); |
| } else { |
|
zra
2017/07/28 21:47:46
The else is unnecessary.
alexmarkov
2017/07/28 23:09:29
Done.
|
| - return Integer::New(value, space); |
| + return Integer::New(static_cast<int64_t>(value), space); |
| + } |
| +} |
| + |
| +bool Integer::IsValidUint64(uint64_t value) { |
| + if (FLAG_limit_ints_to_64_bits) { |
| + return (value <= static_cast<uint64_t>(Mint::kMaxValue)); |
| + } else { |
|
zra
2017/07/28 21:47:46
ditto
alexmarkov
2017/07/28 23:09:29
In this particular case I think 'else' adds readab
|
| + return true; |
| } |
| } |