diff options
author | Roland Levillain <rpl@google.com> | 2015-03-12 17:00:14 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-03-12 17:00:15 +0000 |
commit | 97d30aca68af2aa4f114a01d7a7d73e4bf009fe0 (patch) | |
tree | e441187dfab14ffab41aff6576df6aaa14ce8b1c /runtime/utils.h | |
parent | 3848c4fbc189287bca1298d45d07e21ec90c7c82 (diff) | |
parent | b2fd7bca70b580921eebf7c45769c39d2dfd8a5a (diff) | |
download | android_art-97d30aca68af2aa4f114a01d7a7d73e4bf009fe0.tar.gz android_art-97d30aca68af2aa4f114a01d7a7d73e4bf009fe0.tar.bz2 android_art-97d30aca68af2aa4f114a01d7a7d73e4bf009fe0.zip |
Merge "Opt compiler: Basic simplification for arithmetic operations."
Diffstat (limited to 'runtime/utils.h')
-rw-r--r-- | runtime/utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/utils.h b/runtime/utils.h index 0c11610932..cd04c3ff2c 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -289,6 +289,12 @@ static constexpr int CTZ(T x) { } template<typename T> +static inline int WhichPowerOf2(T x) { + DCHECK((x != 0) && IsPowerOfTwo(x)); + return CTZ(x); +} + +template<typename T> static constexpr int POPCOUNT(T x) { return (sizeof(T) == sizeof(uint32_t)) ? __builtin_popcount(x) |