| 71 | } |
| 72 | return out; |
| 73 | } |
| 74 | |
| 75 | size_t checked_mib_to_bytes(int64_t mb, std::string_view key) { |
| 76 | constexpr int64_t kMiB = 1024 * 1024; |
| 77 | if (mb > static_cast<int64_t>(std::numeric_limits<size_t>::max() / kMiB)) { |
| 78 | throw std::runtime_error(std::string(key) + " is too large"); |
| 79 | } |
| 80 | return static_cast<size_t>(mb) * static_cast<size_t>(kMiB); |
| 81 | } |
| 82 |
no test coverage detected