Otapreopt: Add missing function
Add function for debug check.
Test: mmma frameworks/native/cmds/installd
Change-Id: Id32fb37ea1017c0a2fb2d2d66b1728a76fbc3dd5
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index 4c75eb5..355fe45 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -88,6 +88,12 @@
"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) {