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

Function parse_cpu_range

common/common.cpp:290–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290bool parse_cpu_range(const std::string & range, bool (&boolmask)[GGML_MAX_N_THREADS]) {
291 size_t dash_loc = range.find('-');
292 if (dash_loc == std::string::npos) {
293 LOG_ERR("Format of CPU range is invalid! Expected [<start>]-[<end>].\n");
294 return false;
295 }
296
297 size_t start_i;
298 size_t end_i;
299
300 if (dash_loc == 0) {
301 start_i = 0;
302 } else {
303 start_i = std::stoull(range.substr(0, dash_loc));
304 if (start_i >= GGML_MAX_N_THREADS) {
305 LOG_ERR("Start index out of bounds!\n");
306 return false;
307 }
308 }
309
310 if (dash_loc == range.length() - 1) {
311 end_i = GGML_MAX_N_THREADS - 1;
312 } else {
313 end_i = std::stoull(range.substr(dash_loc + 1));
314 if (end_i >= GGML_MAX_N_THREADS) {
315 LOG_ERR("End index out of bounds!\n");
316 return false;
317 }
318 }
319
320 for (size_t i = start_i; i <= end_i; i++) {
321 boolmask[i] = true;
322 }
323
324 return true;
325}
326
327bool parse_cpu_mask(const std::string & mask, bool (&boolmask)[GGML_MAX_N_THREADS]) {
328 // Discard potential 0x prefix

Callers 1

Calls 2

findMethod · 0.80
lengthMethod · 0.80

Tested by

no test coverage detected