summaryrefslogtreecommitdiff
path: root/impl/IdSet.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'impl/IdSet.hpp')
-rw-r--r--impl/IdSet.hpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/impl/IdSet.hpp b/impl/IdSet.hpp
index 2ba88d3..f845325 100644
--- a/impl/IdSet.hpp
+++ b/impl/IdSet.hpp
@@ -45,6 +45,12 @@ class IdSet {
return *this;
}
+ void invert() {
+ for (unsigned int i = 0; i < DIV_ROUND_UP(_length, CELL_SIZE); ++i) {
+ _values[i] = ~_values[i];
+ }
+ }
+
bool contains(const T& obj) const {
unsigned int id = obj.id();
if (id >= _length) {
@@ -125,7 +131,8 @@ class IdSet {
do {
index++;
for (;; index += CELL_SIZE) {
- if (index == set._length) {
+ if (index >= set._length) {
+ index = set._length;
return *this;
}
cell = index / CELL_SIZE;