MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / parse_descr

Function parse_descr

include/libnpy/npy.hpp:164–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164inline dtype_t parse_descr(std::string typestring) {
165 if (typestring.length() < 3) {
166 throw std::runtime_error("invalid typestring (length)");
167 }
168
169 char byteorder_c = typestring.at(0);
170 char kind_c = typestring.at(1);
171 std::string itemsize_s = typestring.substr(2);
172
173 if (!in_array(byteorder_c, endian_chars)) {
174 throw std::runtime_error("invalid typestring (byteorder)");
175 }
176
177 if (!in_array(kind_c, numtype_chars)) {
178 throw std::runtime_error("invalid typestring (kind)");
179 }
180
181 if (!is_digits(itemsize_s)) {
182 throw std::runtime_error("invalid typestring (itemsize)");
183 }
184 unsigned int itemsize = std::stoul(itemsize_s);
185
186 return {byteorder_c, kind_c, itemsize};
187}
188
189namespace pyparse {
190

Callers 1

parse_headerFunction · 0.85

Calls 3

in_arrayFunction · 0.85
is_digitsFunction · 0.85
stoulFunction · 0.85

Tested by

no test coverage detected