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; }
//bitset2.logicalnot(notbitset); static JSVAL bs_logicalnot(JSARGS args) { HandleScope scope; EWAHBoolArray<LENGTH>* bs = (EWAHBoolArray<LENGTH>*) External::Unwrap(args[0]); if (!bs) { return v8::ThrowException(v8::String::New("In logicalnot bitset 1 is Null")); } EWAHBoolArray<LENGTH>* bs2 = (EWAHBoolArray<LENGTH>*) External::Unwrap(args[1]); if (!bs2) { return v8::ThrowException(v8::String::New("In logicalnot bitset 2 is Null")); } bs->logicalnot(*bs2); return scope.Close(Null()); }