示例#1
0
        public QRPolynomial Mod(QRPolynomial e)
        {
            bool         flag = Convert.ToInt64(this.GetLength()) - Convert.ToInt64(e.GetLength()) < 0L;
            QRPolynomial result;

            if (flag)
            {
                result = this;
            }
            else
            {
                int       num  = QRMath.GLog(this.Get(0)) - QRMath.GLog(e.Get(0));
                DataCache num2 = new DataCache(this.GetLength());
                for (int index = 0; index < this.GetLength(); index++)
                {
                    num2[index] = this.Get(index);
                }
                for (int index2 = 0; index2 < e.GetLength(); index2++)
                {
                    List <int> list;
                    int        index3;
                    (list = num2)[index3 = index2] = (list[index3] ^ QRMath.GExp(QRMath.GLog(e.Get(index2)) + num));
                }
                result = new QRPolynomial(num2, 0).Mod(e);
            }
            return(result);
        }
示例#2
0
        public QRPolynomial Multiply(QRPolynomial e)
        {
            DataCache num = new DataCache(this.GetLength() + e.GetLength() - 1);

            for (int index = 0; index < this.GetLength(); index++)
            {
                for (int index2 = 0; index2 < e.GetLength(); index2++)
                {
                    List <int> list;
                    int        index3;
                    (list = num)[index3 = index + index2] = (list[index3] ^ QRMath.GExp(QRMath.GLog(this.Get(index)) + QRMath.GLog(e.Get(index2))));
                }
            }
            return(new QRPolynomial(num, 0));
        }
示例#3
0
        private DataCache CreateBytes(QRBitBuffer buffer, List <QRRSBlock> rsBlocks)
        {
            int num    = 0;
            int val1_  = 0;
            int val1_2 = 0;

            DataCache[] dataCacheArray  = new DataCache[rsBlocks.Count];
            DataCache[] dataCacheArray2 = new DataCache[rsBlocks.Count];
            for (int index = 0; index < rsBlocks.Count; index++)
            {
                int dataCount = rsBlocks[index].DataCount;
                int num2      = rsBlocks[index].TotalCount - dataCount;
                val1_  = Math.Max(val1_, dataCount);
                val1_2 = Math.Max(val1_2, num2);
                dataCacheArray[index] = new DataCache(dataCount);
                for (int index2 = 0; index2 < dataCacheArray[index].Count; index2++)
                {
                    dataCacheArray[index][index2] = (255 & buffer.m_buffer[index2 + num]);
                }
                num += dataCount;
                QRPolynomial correctPolynomial = QRUtil.GetErrorCorrectPolynomial(num2);
                QRPolynomial qrPolynomial      = new QRPolynomial(dataCacheArray[index], correctPolynomial.GetLength() - 1).Mod(correctPolynomial);
                dataCacheArray2[index] = new DataCache(correctPolynomial.GetLength() - 1);
                for (int index3 = 0; index3 < dataCacheArray2[index].Count; index3++)
                {
                    int index4 = index3 + qrPolynomial.GetLength() - dataCacheArray2[index].Count;
                    dataCacheArray2[index][index3] = ((index4 >= 0) ? qrPolynomial.Get(index4) : 0);
                }
            }
            int capacity = 0;

            for (int index5 = 0; index5 < rsBlocks.Count; index5++)
            {
                capacity += rsBlocks[index5].TotalCount;
            }
            DataCache dataCache = new DataCache(capacity);
            int       num3      = 0;

            for (int index6 = 0; index6 < val1_; index6++)
            {
                for (int index7 = 0; index7 < rsBlocks.Count; index7++)
                {
                    bool flag = index6 < dataCacheArray[index7].Count;
                    if (flag)
                    {
                        dataCache[num3++] = dataCacheArray[index7][index6];
                    }
                }
            }
            for (int index8 = 0; index8 < val1_2; index8++)
            {
                for (int index9 = 0; index9 < rsBlocks.Count; index9++)
                {
                    bool flag2 = index8 < dataCacheArray2[index9].Count;
                    if (flag2)
                    {
                        dataCache[num3++] = dataCacheArray2[index9][index8];
                    }
                }
            }
            return(dataCache);
        }