[Solved] How can i define a bool array in VC++ with more than MAXINT Elements


class largeBoolArray
{
private:
    bool **myMintherms;
    unsigned long long dim;
    unsigned int dimPointers;
public:
    largeBoolArray()
    {
        myMintherms = NULL;
        dim = 0;
        dimPointers = 0;
    };
    largeBoolArray(unsigned long long Dim)
    {
        assert(Dim > 0);
        dim = Dim;
        dimPointers = ((unsigned int) (Dim & 0xFFFFFFFF80000000) >> 31) + 1;
        myMintherms = new bool*[dimPointers];
        for (unsigned int i = 0; i < dimPointers; i++)
        {
            while (dim > 0)
            {
                if (dim > 0x80000000)
                {
                    myMintherms[i] = new bool[0x80000000];
                    for (unsigned long long j = 0ll; j < 0x7fffffff; j++)
                        myMintherms[i][j] = false;
                    dim -= 0x80000000;
                }
                else
                {
                    myMintherms[i] = new bool[dim];
                    for (unsigned long long j = 0ll; j < dim; j++)
                        myMintherms[i][j] = false;
                    dim = 0;
                }
            }
            dim = Dim;
        }
    }
    ~largeBoolArray()
    {
        if (myMintherms != NULL)
        {
            for (unsigned int i = 0; i < dimPointers; i++)
            {
                if (myMintherms[i] != NULL)
                delete[] myMintherms[i];
            }
            delete[] myMintherms;
        }
    }
    bool& operator[] (unsigned long long selektor)
    {
        unsigned int firstIndex = (unsigned int)(selektor & 0xFFFFFFFF80000000) >> 31;
        unsigned int secondIndex = (selektor & 0x7FFFFFFF);
        return myMintherms[firstIndex][secondIndex];
    }
    largeBoolArray operator= (largeBoolArray o1)
    {
        this->dim = o1.dim;
        this->dimPointers = o1.dimPointers;
        this->myMintherms = new bool*[dimPointers];
        unsigned long long dimRest;
        for (unsigned int i = 0; i < dimPointers; i++)
        {
            dimRest = dim;
            while (dimRest > 0)
            {
                if (dimRest > 0x80000000)
                {
                    this->myMintherms[i] = new bool[0x80000000];
                    for (unsigned long long j = 0ll; j < 0x7fffffff; j++)
                        this->myMintherms[i][j] = o1.myMintherms[i][j];
                    dimRest -= 0x80000000;
                }
                else
                {
                    this->myMintherms[i] = new bool[dimRest];
                    for (unsigned long long j = 0ll; j < dimRest; j++)
                        this->myMintherms[i][j] = o1.myMintherms[i][j];
                    dimRest = 0;
                }
            }
        }

        return *this;
    }
    void clear()
    {
        for (unsigned long long i = 0ll; i < dim; i++)
            (*this)[i] = false;
    }
};

9

solved How can i define a bool array in VC++ with more than MAXINT Elements