Ejemplo n.º 1
0
bool testGet() {
    cout << "[testing Get] sizeof(uword)=" << sizeof(uword) << endl;
    bool isOk = true;

    for (size_t gap = 29; gap < 10000; gap *= 10) {
        EWAHBoolArray<uword> x;
        for (uint32_t k = 0; k < 100; ++k)
            x.set(k * gap);
        for (size_t k = 0; k < 100 * gap; ++k)
            if (x.get(k)) {
                if (k % gap != 0) {
                    cout << "spotted an extra set bit at " << k << " gap = "
                         << gap << endl;
                    return false;
                }
            } else if (k % gap == 0) {
                cout<<
                    "missed a set bit " << k
                    << " gap = " << gap<<endl;
                return false;
            }
    }
    return isOk;
}