Exemplo n.º 1
0
bool testCardinalityBoolArray() {
    cout << "[testing CardinalityBoolArray] sizeof(uword)=" << sizeof(uword) << endl;
    BoolArray<uword> b1 = BoolArray<uword>::bitmapOf(1,1);
    if (b1.numberOfOnes() != 1) {
        return false;
    }
    b1.inplace_logicalnot();
    if (b1.numberOfOnes() != 1) {
        return false;
    }

    BoolArray<uword> b = BoolArray<uword>::bitmapOf(2,1,100);
    if(b.numberOfOnes() != 2) {
        return false;
    }
    BoolArray<uword> bout;
    b.logicalnot(bout);
    if(bout.numberOfOnes() != 99) {
        return false;
    }
    b.inplace_logicalnot();
    if(b.numberOfOnes() != 99) {
        return false;
    }
    return true;
}
Exemplo n.º 2
0
bool testAndNotBoolArray() {
    cout << "[testing AndNotBoolArray] sizeof(uword)=" << sizeof(uword) << endl;
    BoolArray<uword> b1 = BoolArray<uword>::bitmapOf(1,1);
    BoolArray<uword> b = BoolArray<uword>::bitmapOf(2,1,100);
    BoolArray<uword> bout;
    b.logicalandnot(b1,bout);
    if (bout.numberOfOnes() != 1) {
        return false;
    }
    return true;
}