Commit 5b908800 authored by Maximilien Colange's avatar Maximilien Colange
Browse files

a few improvements to mark_t

* spot/misc/bitset.hh: add methods set() and clear()
* spot/twa/acc.hh: deprecate comparison of mark_t with unsigned, and
  rely more on biset for efficiency
parent 88a6bd82
Pipeline #1864 passed with stage
in 111 minutes and 22 seconds
......@@ -124,6 +124,18 @@ namespace spot
return other.operator<=(*this);
}
void set(unsigned s)
{
SPOT_ASSERT(s < 8*N*sizeof(word_t));
data[s / (8*sizeof(word_t))] |= 1U << (s % (8*sizeof(word_t)));
}
void clear(unsigned s)
{
SPOT_ASSERT(s < 8*N*sizeof(word_t));
data[s / (8*sizeof(word_t))] &= ~(1U << (s % (8*sizeof(word_t))));
}
bitset operator<<(unsigned s) const
{
bitset r = *this;
......
......@@ -96,9 +96,7 @@ namespace spot
static mark_t all()
{
mark_t res({});
res.id -= 1;
return res;
return mark_t(_value_t::mone());
}
size_t hash() const noexcept
......@@ -107,12 +105,14 @@ namespace spot
return h(id);
}
SPOT_DEPRECATED("compare mark_t to mark_t, not to unsigned")
bool operator==(unsigned o) const
{
SPOT_ASSERT(o == 0U);
return !id;
}
SPOT_DEPRECATED("compare mark_t to mark_t, not to unsigned")
bool operator!=(unsigned o) const
{
SPOT_ASSERT(o == 0U);
......@@ -161,12 +161,12 @@ namespace spot
void set(unsigned u)
{
id |= (_value_t::one() << u);
id.set(u);
}
void clear(unsigned u)
{
id &= ~(_value_t::one() << u);
id.clear(u);
}
mark_t& operator&=(mark_t r)
......
Supports Markdown
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