Loading system/gd/packet/parser/enum_def.cc +2 −2 Original line number Diff line number Diff line Loading @@ -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)); Loading system/gd/packet/parser/util.h +2 −7 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading
system/gd/packet/parser/enum_def.cc +2 −2 Original line number Diff line number Diff line Loading @@ -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)); Loading
system/gd/packet/parser/util.h +2 −7 Original line number Diff line number Diff line Loading @@ -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) { Loading