Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1527)

Unified Diff: runtime/vm/object.cc

Issue 732573002: Fix overflow check in the Smi::ShiftOp. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 694d3a93a15b158b1d2e5d3b2b349f3d946f1609..94d9f2bf04b80860a1eab2f3a560ea240f3f28e5 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -15903,9 +15903,9 @@ RawInteger* Smi::ShiftOp(Token::Kind kind,
return raw();
}
{ // Check for overflow.
- int cnt = Utils::HighestBit(left_value);
- if ((cnt + right_value) >= Smi::kBits) {
- if ((cnt + right_value) >= Mint::kBits) {
+ int cnt = Utils::BitLength(left_value);
+ if ((cnt + right_value) > Smi::kBits) {
+ if ((cnt + right_value) > Mint::kBits) {
return Bigint::NewFromShiftedInt64(left_value, right_value);
} else {
int64_t left_64 = left_value;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698