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

Unified Diff: runtime/lib/integers.cc

Issue 1338233002: Fix right shifting of a Mint value by an amount larger than 63. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months 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 | tests/language/bit_shift_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/integers.cc
diff --git a/runtime/lib/integers.cc b/runtime/lib/integers.cc
index b1ca62c3e311877ca86ac568531c416d42b56f18..e8d655ca416b741a98b559dfacaf451788bea44b 100644
--- a/runtime/lib/integers.cc
+++ b/runtime/lib/integers.cc
@@ -275,7 +275,9 @@ static RawInteger* ShiftOperationHelper(Token::Kind kind,
case Token::kSHL:
return Integer::New(mint_value << shift_count, Heap::kNew, silent);
case Token::kSHR:
- return Integer::New(mint_value >> -shift_count, Heap::kNew, silent);
+ shift_count =
+ (-shift_count > Mint::kBits) ? Mint::kBits : -shift_count;
+ return Integer::New(mint_value >> shift_count, Heap::kNew, silent);
default:
UNIMPLEMENTED();
}
« no previous file with comments | « no previous file | tests/language/bit_shift_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698