Commit dfd8bb23 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

another round of fixes for the cpuset code

parent 892b4c71
......@@ -167,17 +167,12 @@ public:
return lhs;
}
//bool& operator[](std::size_t cpu)
//{
// void cpuset_set_cpu(cpuset_t*setp, cpu_t cpu, int state)
//}
bool operator[](size_t cpu) const
{
return isset(cpu);
return isSet(cpu);
}
bool isset(size_t cpu) const
bool isSet(size_t cpu) const
{
return CPU_ISSET_S(cpu, sz, setp);
}
......
......@@ -84,7 +84,7 @@ CpuSet::operator uintmax_t()
uintmax_t iset = 0;
for (size_t i = 0; i < num_cpus; i++) {
if (isset(i))
if (isSet(i))
iset |= 1ULL << i;
}
......@@ -98,10 +98,10 @@ CpuSet::operator std::string ()
bool first = true;
for (size_t i = 0; i < num_cpus; i++) {
if (isset(i)) {
if (isSet(i)) {
size_t run = 0;
for (size_t j = i + 1; j < num_cpus; j++) {
if (!isset(j))
if (!isSet(j))
break;
run++;
......
......@@ -88,8 +88,8 @@ Test(utils, cpuset)
cr_assert_eq(cset3, cset4);
cr_assert_eq(cset3.count(), 5);
cr_assert(cset3.isset(3));
cr_assert_not(cset3.isset(6));
cr_assert(cset3.isSet(3));
cr_assert_not(cset3.isSet(6));
cr_assert(cset3[3]);
cr_assert_not(cset3[6]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment