Example #1
0
static bool
SlowRekey(IntSet *s) {
    IntSet tmp;
    tmp.init();

    for (IntSet::Range r = s->all(); !r.empty(); r.popFront()) {
        if (NewKeyFunction::shouldBeRemoved(r.front()))
            continue;
        uint32_t hi = NewKeyFunction::rekey(r.front());
        if (tmp.has(hi))
            return false;
        tmp.putNew(hi);
    }

    s->clear();
    for (IntSet::Range r = tmp.all(); !r.empty(); r.popFront()) {
        s->putNew(r.front());
    }

    return true;
}
Example #2
0
 static void init(IntSet& s, const IntArgs& i) {
   if (i.size() > 0)
     s.init(&i[0],i.size());
 }