Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a64a6270 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Otapreopt: Add missing function

Add function for debug check.

Test: mmma frameworks/native/cmds/installd
Change-Id: Id32fb37ea1017c0a2fb2d2d66b1728a76fbc3dd5
parent 8b8ce408
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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) {