MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / checked_mib_to_bytes

Function checked_mib_to_bytes

src/framework/runtime/options.cpp:73–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 }
72 return out;
73}
74
75size_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

Callers 1

parse_size_mb_optionFunction · 0.85

Calls 2

maxFunction · 0.85
stringFunction · 0.50

Tested by

no test coverage detected