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

Unified Diff: src/utils.h

Issue 9233050: Reduce memory use immediately after boot. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 11 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: src/utils.h
===================================================================
--- src/utils.h (revision 10555)
+++ src/utils.h (working copy)
@@ -153,11 +153,9 @@
}
-// Returns the smallest power of two which is >= x. If you pass in a
-// number that is already a power of two, it is returned as is.
-// Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
-// figure 3-3, page 48, where the function is called clp2.
-inline uint32_t RoundUpToPowerOf2(uint32_t x) {
+template<typename int_type>
+inline int RoundUpToPowerOf2(int_type x_argument) {
+ uintptr_t x = static_cast<uintptr_t>(x_argument);
ASSERT(x <= 0x80000000u);
x = x - 1;
x = x | (x >> 1);
@@ -165,7 +163,7 @@
x = x | (x >> 4);
x = x | (x >> 8);
x = x | (x >> 16);
- return x + 1;
+ return static_cast<int_type>(x + 1);
}
« src/store-buffer.cc ('K') | « src/store-buffer.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698