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

Unified Diff: runtime/platform/utils.cc

Issue 169893003: Another round of cleanups for http://www.dartbug.com/15922 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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
===================================================================
--- runtime/platform/utils.cc (revision 32732)
+++ runtime/platform/utils.cc (working copy)
@@ -8,13 +8,16 @@
// Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
// figure 3-3, page 48, where the function is called clp2.
-uint32_t Utils::RoundUpToPowerOfTwo(uint32_t x) {
+uintptr_t Utils::RoundUpToPowerOfTwo(uintptr_t x) {
x = x - 1;
x = x | (x >> 1);
x = x | (x >> 2);
x = x | (x >> 4);
x = x | (x >> 8);
x = x | (x >> 16);
+#if defined(ARCH_IS_64_BIT)
+ x = x | (x >> 32);
+#endif // defined(ARCH_IS_64_BIT)
return x + 1;
}

Powered by Google App Engine
This is Rietveld 408576698