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

Unified Diff: runtime/platform/utils.cc

Issue 10968058: Support constant folding of instructions with constant smi values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
Index: runtime/platform/utils.cc
diff --git a/runtime/platform/utils.cc b/runtime/platform/utils.cc
index 30a5ceef820877acf218e9eae29ca6e626271278..543b95021282a988ea54ffe0cc94ed4452b048f8 100644
--- a/runtime/platform/utils.cc
+++ b/runtime/platform/utils.cc
@@ -31,6 +31,16 @@ int Utils::CountOneBits(uint32_t x) {
}
+int Utils::HighestBit(int64_t v) {
+ uint64_t t = static_cast<uint64_t>((v > 0) ? v : -v);
+ int count = 0;
+ while ((t >>= 1) != 0) {
+ count++;
+ }
+ return count;
+}
+
+
uint32_t Utils::StringHash(const char* data, int length) {
// This implementation is based on the public domain MurmurHash
// version 2.0. It assumes that the underlying CPU can read from
@@ -88,4 +98,5 @@ uint32_t Utils::WordHash(word key) {
return static_cast<uint32_t>(a);
}
+
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698