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

Unified Diff: src/utils.h

Issue 2701003: Revert r4782. Fix issues 728, 732. (Closed)
Patch Set: fix review remarks, add static checks Created 10 years, 6 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
« src/objects.h ('K') | « src/objects-inl.h ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils.h
diff --git a/src/utils.h b/src/utils.h
index 1c7120eaf2041b809a8026421643a4ea4cdba022..ed6d9a4fee1c7e6158ec88fe8d607825cb609c79 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -37,11 +37,13 @@ namespace internal {
// ----------------------------------------------------------------------------
// General helper functions
+#define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)
+
// Returns true iff x is a power of 2 (or zero). Cannot be used with the
// maximally negative value of the type T (the -1 overflows).
template <typename T>
static inline bool IsPowerOf2(T x) {
- return (x & (x - 1)) == 0;
+ return IS_POWER_OF_TWO(x);
}
« src/objects.h ('K') | « src/objects-inl.h ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698