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

Function read_magic

include/libnpy/npy.hpp:115–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115inline version_t read_magic(std::istream &istream) {
116 char buf[magic_string_length + 2];
117 istream.read(buf, magic_string_length + 2);
118
119 if (!istream) {
120 throw std::runtime_error("io error: failed reading file");
121 }
122
123 if (0 != std::memcmp(buf, magic_string, magic_string_length))
124 throw std::runtime_error("this file does not have a valid npy format.");
125
126 version_t version;
127 version.first = buf[magic_string_length];
128 version.second = buf[magic_string_length + 1];
129
130 return version;
131}
132
133const std::unordered_map<std::type_index, dtype_t> dtype_map = {
134 {std::type_index(typeid(float)), {host_endian_char, 'f', sizeof(float)}},

Callers 1

read_headerFunction · 0.85

Calls 1

readMethod · 0.80

Tested by

no test coverage detected