Fixed fake CPU handling.

This commit is contained in:
gibbed 2016-06-20 12:52:36 -05:00
parent 6a082c42d3
commit 27610989a2
1 changed files with 2 additions and 5 deletions

View File

@ -154,17 +154,14 @@ void XThread::set_name(const std::string& name) {
uint8_t next_cpu = 0; uint8_t next_cpu = 0;
uint8_t GetFakeCpuNumber(uint8_t proc_mask) { uint8_t GetFakeCpuNumber(uint8_t proc_mask) {
if (!proc_mask) { if (!proc_mask) {
next_cpu++; next_cpu = (next_cpu + 1) % 6;
if (next_cpu > 6) {
next_cpu = 0;
}
return next_cpu; // is this reasonable? return next_cpu; // is this reasonable?
} }
assert_false(proc_mask & 0xC0); assert_false(proc_mask & 0xC0);
uint8_t cpu_number = 7 - xe::lzcnt(proc_mask); uint8_t cpu_number = 7 - xe::lzcnt(proc_mask);
assert_true(1 << cpu_number == proc_mask); assert_true(1 << cpu_number == proc_mask);
assert_true(cpu_number < 6);
return cpu_number; return cpu_number;
} }