diff options
| author | 2018-07-10 23:56:45 +0000 | |
|---|---|---|
| committer | 2018-07-10 23:56:45 +0000 | |
| commit | d760eb86623e011ea2fec592f164c07170de6d70 (patch) | |
| tree | c97b6c493bde5d34e5056b56230d3c4e1c4a6cca | |
| parent | 7d092e6ad606c10f4a33e9d2250de7a1451e001a (diff) | |
| parent | a64a627076e1362f0d38ce6277570d44ae420563 (diff) | |
Merge "Otapreopt: Add missing function"
| -rw-r--r-- | cmds/installd/otapreopt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp index 4c75eb51e1..355fe456a2 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) { |