Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice committed Jan 7, 2023
1 parent d4d91d4 commit f4df1be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/common/parse_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

// num << bit <= MAX -> num <= MAX >> bit
template <typename T, typename U>
StatusOr<T> CheckedShl(T num, U bit) {
StatusOr<T> CheckedShiftLeft(T num, U bit) {
if (num <= std::numeric_limits<T>::max() >> bit) {
return num << bit;
}
Expand All @@ -38,15 +38,15 @@ StatusOr<std::uint64_t> ParseSizeAndUnit(const std::string &v) {
if (*rest == 0) {
return num;
} else if (Util::EqualICase(rest, "k")) {
return CheckedShl(num, 10);
return CheckedShiftLeft(num, 10);
} else if (Util::EqualICase(rest, "m")) {
return CheckedShl(num, 20);
return CheckedShiftLeft(num, 20);
} else if (Util::EqualICase(rest, "g")) {
return CheckedShl(num, 30);
return CheckedShiftLeft(num, 30);
} else if (Util::EqualICase(rest, "t")) {
return CheckedShl(num, 40);
return CheckedShiftLeft(num, 40);
} else if (Util::EqualICase(rest, "p")) {
return CheckedShl(num, 50);
return CheckedShiftLeft(num, 50);
}

return {Status::NotOK, "encounter unexpected unit"};
Expand Down

0 comments on commit f4df1be

Please sign in to comment.