Beispiel #1
0
        BoolStruct _getSecond(ushort nIndex)
        {
            BoolStruct result = new BoolStruct(
                BoolType_.mNone_, 0, 0, 0);

            if (nIndex < 1)
            {
                result._setBoolType(BoolType_.mIndex_);
                return(result);
            }
            int    count  = nIndex * mSize;
            ushort length = (ushort)(count / 64);
            byte   secPos = (byte)(count % 64);

            if (secPos > 0)
            {
                secPos -= 1;
            }
            else
            {
                length -= 1;
                secPos  = 63;
            }
            if (length >= mValue.Length)
            {
                result._setBoolType(
                    BoolType_.mOverflow_);
                return(result);
            }
            result._setBoolType(BoolType_.mSucess_);
            result._setLength(length);
            result._setSecond(secPos);
            return(result);
        }
Beispiel #2
0
        __tuple <BoolStruct, BoolStruct> _getIndex(
            ushort nIndex)
        {
            BoolStruct first = new BoolStruct(
                BoolType_.mNone_, 0, 0, 0);
            BoolStruct second = new BoolStruct(
                BoolType_.mNone_, 0, 0, 0);

            if (nIndex < 1)
            {
                first._setBoolType(BoolType_.mIndex_);
                second._setBoolType(BoolType_.mIndex_);
                return(new __tuple <BoolStruct,
                                    BoolStruct>(first, second));
            }
            int    count  = nIndex * mSize;
            ushort length = (ushort)(count / 64);
            byte   secPos = (byte)(count % 64);

            if (secPos > 0)
            {
                secPos -= 1;
            }
            else
            {
                length -= 1;
                secPos  = 63;
            }
            if (length >= mValue.Length)
            {
                first._setBoolType(
                    BoolType_.mOverflow_);
                second._setBoolType(
                    BoolType_.mOverflow_);
                return(new __tuple <BoolStruct,
                                    BoolStruct>(first, second));
            }
            if (mSize < (secPos + 2))
            {
                first._setBoolType(
                    BoolType_.mSucess_);
                byte fstPos =
                    (byte)(secPos + 1);
                fstPos -= mSize;
                first._setFirst(fstPos);
                first._setSecond(secPos);
                first._setLength(length);
            }
            else
            {
                second._setBoolType(
                    BoolType_.mSucess_);
                second._setFirst(0);
                second._setSecond(secPos);
                second._setLength(length);
                first._setBoolType(
                    BoolType_.mSucess_);
                byte fstPos =
                    (byte)(mSize - secPos);
                fstPos = (byte)(65 - fstPos);
                first._setFirst(fstPos);
                first._setSecond(63);
                length -= 1;
                first._setLength(length);
            }
            return(new __tuple <BoolStruct,
                                BoolStruct>(first, second));
        }