MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / gguf_skip_value

Function gguf_skip_value

tests/gguf-model-data.cpp:82–125  ·  view source on GitHub ↗

Equivalent of readMetadataValue(), skips unused values rather than storing

Source from the content-addressed store, hash-verified

80
81// Equivalent of readMetadataValue(), skips unused values rather than storing
82static bool gguf_skip_value(gguf_buf_reader & r, int32_t vtype) {
83 if (vtype == GGUF_TYPE_STRING) {
84 std::string tmp;
85 return r.read_str(tmp);
86 }
87 if (vtype == GGUF_TYPE_ARRAY) {
88 int32_t elem_type;
89 uint64_t count;
90 if (!r.read_val(elem_type)) {
91 return false;
92 }
93 if (!r.read_val(count)) {
94 return false;
95 }
96 if (elem_type == GGUF_TYPE_STRING) {
97 for (uint64_t i = 0; i < count; i++) {
98 std::string tmp;
99 if (!r.read_str(tmp)) {
100 return false;
101 }
102 }
103 return true;
104 }
105 if (elem_type == GGUF_TYPE_ARRAY) {
106 // nested arrays - recurse
107 for (uint64_t i = 0; i < count; i++) {
108 if (!gguf_skip_value(r, GGUF_TYPE_ARRAY)) {
109 return false;
110 }
111 }
112 return true;
113 }
114 size_t elem_sz = gguf_val_type_size(elem_type);
115 if (elem_sz == 0) {
116 return false;
117 }
118 return r.skip((size_t)count * elem_sz);
119 }
120 size_t sz = gguf_val_type_size(vtype);
121 if (sz == 0) {
122 return false;
123 }
124 return r.skip(sz);
125}
126
127static bool gguf_read_uint32_val(gguf_buf_reader & r, int32_t vtype, uint32_t & out) {
128 // Handle array-valued fields (e.g. per-layer head counts in hybrid models)

Callers 1

gguf_parse_metaFunction · 0.85

Calls 4

gguf_val_type_sizeFunction · 0.85
read_strMethod · 0.80
read_valMethod · 0.80
skipMethod · 0.80

Tested by

no test coverage detected