summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2018-07-10 18:21:29 -0700
committer android-build-merger <android-build-merger@google.com> 2018-07-10 18:21:29 -0700
commita9631050dc446bf1e5613f1055f2dcd3255c44dd (patch)
treee6f447ca0cf7dd6cd2e519ecd6117c164e6b572d
parent094ba126c3dc4d54a2ed3f5be4a7fbfed35c8825 (diff)
parent70564d5736a108939d4ec97a349e291970bf3bef (diff)
Merge "Otapreopt: Add missing function" am: d760eb8662
am: 70564d5736 Change-Id: Ib98df57068e392d4669f48893ee9bc7e1dbdaaef
-rw-r--r--cmds/installd/otapreopt.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index 96d8c47a8a..7291ef3afa 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -88,6 +88,12 @@ static_assert(DEXOPT_MASK == (0x1dfe | DEXOPT_IDLE_BACKGROUND_JOB),
"DEXOPT_MASK unexpected.");
+template<typename T>
+static constexpr bool IsPowerOfTwo(T x) {
+ static_assert(std::is_integral<T>::value, "T must be integral");
+ // TODO: assert unsigned. There is currently many uses with signed values.
+ return (x & (x - 1)) == 0;
+}
template<typename T>
static constexpr T RoundDown(T x, typename std::decay<T>::type n) {