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

Unified Diff: runtime/lib/integers.cc

Issue 712993005: Infer range for BIT_XOR. (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 | runtime/platform/utils.h » ('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 783b8d3bfa73352dc16d270eeec79978a97a4814..257e680b6c960e09317cdf90c03bc23ab79388ab 100644
--- a/runtime/lib/integers.cc
+++ b/runtime/lib/integers.cc
@@ -36,13 +36,6 @@ static bool CheckInteger(const Integer& i) {
}
-static int BitLengthInt64(int64_t value) {
- value ^= value >> (8 * sizeof(value) - 1); // flip bits if negative.
- // TODO(regis): Utils::HighestBit handles negative values. Why the above?
- return value == 0 ? 0 : Utils::HighestBit(value) + 1;
-}
-
-
DEFINE_NATIVE_ENTRY(Integer_bitAndFromInteger, 2) {
const Integer& right = Integer::CheckedHandle(arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1));
@@ -365,7 +358,7 @@ DEFINE_NATIVE_ENTRY(Smi_bitLength, 1) {
OS::Print("Smi_bitLength: %s\n", operand.ToCString());
}
int64_t value = operand.AsInt64Value();
- intptr_t result = BitLengthInt64(value);
+ intptr_t result = Utils::BitLength(value);
ASSERT(Smi::IsValid(result));
return Smi::New(result);
}
@@ -391,7 +384,7 @@ DEFINE_NATIVE_ENTRY(Mint_bitLength, 1) {
OS::Print("Mint_bitLength: %s\n", operand.ToCString());
}
int64_t value = operand.AsInt64Value();
- intptr_t result = BitLengthInt64(value);
+ intptr_t result = Utils::BitLength(value);
ASSERT(Smi::IsValid(result));
return Smi::New(result);
}
« no previous file with comments | « no previous file | runtime/platform/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698