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 |