MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / parse_cpu_set

Method parse_cpu_set

libraries/AP_HAL_Linux/Util.cpp:262–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262bool Util::parse_cpu_set(const char *str, cpu_set_t *cpu_set) const
263{
264 unsigned long cpu1, cpu2;
265 char *endptr, sep;
266
267 CPU_ZERO(cpu_set);
268
269 do {
270 cpu1 = strtoul(str, &endptr, 10);
271 if (str == endptr) {
272 return false;
273 }
274
275 str = endptr + 1;
276 sep = *endptr;
277 if (sep == ',' || sep == '\0') {
278 CPU_SET(cpu1, cpu_set);
279 continue;
280 }
281
282 if (sep != '-') {
283 return false;
284 }
285
286 cpu2 = strtoul(str, &endptr, 10);
287 if (str == endptr) {
288 return false;
289 }
290
291 str = endptr + 1;
292 for (; cpu1 <= cpu2; cpu1++) {
293 CPU_SET(cpu1, cpu_set);
294 }
295 } while (*endptr != '\0');
296
297 return true;
298}

Callers 1

runMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected