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

Function parse_u64_value

src/framework/runtime/options.cpp:49–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48 return static_cast<uint32_t>(out);
49}
50
51uint64_t parse_u64_value(const std::string & value, std::string_view key) {
52 if (!value.empty() && value.front() == '-') {
53 throw std::runtime_error(std::string(key) + " must be an unsigned integer");
54 }
55 size_t parsed = 0;
56 const unsigned long long out = std::stoull(value, &parsed);
57 if (parsed != value.size()) {
58 throw std::runtime_error(std::string(key) + " must be an unsigned integer");
59 }
60 if (out > std::numeric_limits<uint64_t>::max()) {
61 throw std::runtime_error(std::string(key) + " is outside uint64 range");
62 }
63 return static_cast<uint64_t>(out);
64}
65

Callers 1

parse_u64_optionFunction · 0.85

Calls 4

maxFunction · 0.85
stringFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected