Example #1
0
bool testCardinalityEWAHBoolArray() {
    cout << "[testing CardinalityEWAHBoolArray] sizeof(uword)=" << sizeof(uword) << endl;
    EWAHBoolArray<uword> b1 = EWAHBoolArray<uword>::bitmapOf(1,1);
    if (b1.numberOfOnes() != 1) {
        return false;
    }
    b1.inplace_logicalnot();
    if (b1.numberOfOnes() != 1) {
        cout<<"b1 "<<b1<<endl;
        return false;
    }

    EWAHBoolArray<uword> b = EWAHBoolArray<uword>::bitmapOf(2,1,100);
    if(b.numberOfOnes() != 2) {
        cout<<"b "<<b<<endl;
        return false;
    }
    EWAHBoolArray<uword> bout;
    b.logicalnot(bout);
    if(bout.numberOfOnes() != 99) {
        cout<<"bout "<<bout<<endl;
        return false;
    }
    b.inplace_logicalnot();
    if(b.numberOfOnes() != 99) {
        cout<<"b neg "<<b<<endl;
        return false;
    }
    return true;
}
Example #2
0
//bitset2.inplace_logicalnot();
static JSVAL bs_inplace_logicalnot(JSARGS args) {
    HandleScope scope;
    EWAHBoolArray<LENGTH>* bs = (EWAHBoolArray<LENGTH>*) External::Unwrap(args[0]);
    if (!bs) {
        return v8::ThrowException(v8::String::New("In inplace_logicalnot bitset is Null"));
    }
        
    bs->inplace_logicalnot();
    
    return scope.Close(Null());
}
Example #3
0
bool testNot() {
    cout << "[testing Not]" << endl;
    bool isOk = true;
    EWAHBoolArray<uword> bitset;
    for (int i = 0; i <= 184; i++) {
        bitset.set(i);
    }
    if (bitset.numberOfOnes() != 185) {
        isOk = false;
    }

    bitset.inplace_logicalnot();
    if (bitset.numberOfOnes() != 0) {
        isOk = false;
    }
    return isOk;
}
Example #4
0
bool testNanJiang() {
    cout << "[testing NanJiang] sizeof(uword)=" << sizeof(uword) << endl;
    EWAHBoolArray<uword> b;
    b.set(5);
    if (b.numberOfOnes() != 1)
        return false;
    b.inplace_logicalnot();
    if (b.numberOfOnes() != 5)
        return false;
    BoolArray<uword> b2;
    b2.set(5);
    if (b2.numberOfOnes() != 1)
        return false;
    b2.inplace_logicalnot();
    if (b2.numberOfOnes() != 5)
        return false;
    return true;
}