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
This commit is contained in:
parent
88a6bd82a3
commit
5b9088006c
2 changed files with 17 additions and 5 deletions
|
|
@ -124,6 +124,18 @@ namespace spot
|
||||||
return other.operator<=(*this);
|
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 operator<<(unsigned s) const
|
||||||
{
|
{
|
||||||
bitset r = *this;
|
bitset r = *this;
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,7 @@ namespace spot
|
||||||
|
|
||||||
static mark_t all()
|
static mark_t all()
|
||||||
{
|
{
|
||||||
mark_t res({});
|
return mark_t(_value_t::mone());
|
||||||
res.id -= 1;
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t hash() const noexcept
|
size_t hash() const noexcept
|
||||||
|
|
@ -107,12 +105,14 @@ namespace spot
|
||||||
return h(id);
|
return h(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPOT_DEPRECATED("compare mark_t to mark_t, not to unsigned")
|
||||||
bool operator==(unsigned o) const
|
bool operator==(unsigned o) const
|
||||||
{
|
{
|
||||||
SPOT_ASSERT(o == 0U);
|
SPOT_ASSERT(o == 0U);
|
||||||
return !id;
|
return !id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPOT_DEPRECATED("compare mark_t to mark_t, not to unsigned")
|
||||||
bool operator!=(unsigned o) const
|
bool operator!=(unsigned o) const
|
||||||
{
|
{
|
||||||
SPOT_ASSERT(o == 0U);
|
SPOT_ASSERT(o == 0U);
|
||||||
|
|
@ -161,12 +161,12 @@ namespace spot
|
||||||
|
|
||||||
void set(unsigned u)
|
void set(unsigned u)
|
||||||
{
|
{
|
||||||
id |= (_value_t::one() << u);
|
id.set(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear(unsigned u)
|
void clear(unsigned u)
|
||||||
{
|
{
|
||||||
id &= ~(_value_t::one() << u);
|
id.clear(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
mark_t& operator&=(mark_t r)
|
mark_t& operator&=(mark_t r)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue