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

Function parse_cpu_mask

common/common.cpp:327–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327bool parse_cpu_mask(const std::string & mask, bool (&boolmask)[GGML_MAX_N_THREADS]) {
328 // Discard potential 0x prefix
329 size_t start_i = 0;
330 if (mask.length() >= 2 && mask.substr(0, 2) == "0x") {
331 start_i = 2;
332 }
333
334 size_t num_digits = mask.length() - start_i;
335 if (num_digits > 128) num_digits = 128;
336
337 size_t end_i = num_digits + start_i;
338
339 for (size_t i = start_i, n = (num_digits*4 - 1); i < end_i; i++, n-=4) {
340 char c = mask.at(i);
341 int8_t id = c;
342
343 if ((c >= '0' && c <= '9')) {
344 id -= '0';
345 } else if (c >= 'a' && c <= 'f') {
346 id -= 'a' - 10;
347 } else if (c >= 'A' && c <= 'F') {
348 id -= 'A' - 10;
349 } else {
350 LOG_ERR("Invalid hex character '%c' at position %d\n", c, int32_t(i));
351 return false;
352 }
353
354 boolmask[ n ] = boolmask[ n ] || ((id & 8) != 0);
355 boolmask[n - 1] = boolmask[n - 1] || ((id & 4) != 0);
356 boolmask[n - 2] = boolmask[n - 2] || ((id & 2) != 0);
357 boolmask[n - 3] = boolmask[n - 3] || ((id & 1) != 0);
358 }
359
360 return true;
361}
362
363void common_init() {
364#if defined(_WIN32)

Callers 2

mainFunction · 0.85

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected