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

Function parse_int_array

src/framework/io/safetensors.cpp:60–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60std::vector<int64_t> parse_int_array(const std::string & text, size_t & pos) {
61 skip_ws(text, pos);
62 if (pos >= text.size() || text[pos] != '[') {
63 throw std::runtime_error("expected '['");
64 }
65 ++pos;
66 std::vector<int64_t> values;
67 while (true) {
68 skip_ws(text, pos);
69 if (pos < text.size() && text[pos] == ']') {
70 ++pos;
71 return values;
72 }
73 values.push_back(parse_int64(text, pos));
74 skip_ws(text, pos);
75 if (pos < text.size() && text[pos] == ',') {
76 ++pos;
77 continue;
78 }
79 if (pos < text.size() && text[pos] == ']') {
80 ++pos;
81 return values;
82 }
83 throw std::runtime_error("invalid integer array");
84 }
85}
86
87void expect_char(const std::string & text, size_t & pos, char expected) {
88 skip_ws(text, pos);

Callers 1

load_safetensors_indexFunction · 0.85

Calls 3

skip_wsFunction · 0.85
parse_int64Function · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected