summaryrefslogtreecommitdiff
path: root/impl/IdSet.hpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-07-02 17:44:17 +1000
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-07-02 17:44:17 +1000
commit785d762d4f5d69e3c89855f68cb0654aace4608d (patch)
treecf26981337afa2ce59dc921bc22655faf33c4281 /impl/IdSet.hpp
parent9e0d0b59f44d781d2cbbff4f83d2ab71b7dc0121 (diff)
Dependency-aware smart fixpoint.
Slows it down *heaps* for the moment. Still need to add the MaxStrategy part, which should speed it up a fair bit. At the moment it has to do a fair bit more work for no benefit.
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;