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

Commit fba30144 authored by Myles Watson's avatar Myles Watson Committed by android-build-merger
Browse files

PDL: Util fixup

am: ad8210f5

Change-Id: I7ec1aae45b977477028317310afa965e1aeb978f
parents eb1b3bd3 ad8210f5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@ EnumDef::EnumDef(std::string name, int size) : TypeDef(name, size){};

void EnumDef::AddEntry(std::string name, uint32_t value) {
  if (value > util::GetMaxValueForBits(size_)) {
    std::cerr << __func__ << ": Value provided is greater than max possible value for enum. " << name_ << "\n";
    abort();
    ERROR() << __func__ << ": Value of " << name << "(" << value << ") is greater than the max possible value for enum "
            << name_ << "(" << util::GetMaxValueForBits(size_) << ")\n";
  }

  constants_.insert(std::pair(value, name));
+2 −7
Original line number Diff line number Diff line
@@ -56,13 +56,8 @@ inline uint64_t GetMaxValueForBits(int bits) {
    ERROR() << __func__ << ": Cannot use a type larger than 64 bits. (" << bits << ")\n";
  }

  uint64_t max = 0;
  for (int i = 0; i < bits; i++) {
    max <<= 1;
    max |= 1;
  }

  return max;
  // Set all the bits to 1, then shift off extras.
  return ~(static_cast<uint64_t>(0)) >> (64 - bits);
}

inline std::string CamelCaseToUnderScore(std::string value) {