Exemple #1
0
            public NativeParser GetNext()
            {
                for (; ;)
                {
                    while (_parser.Offset < _endOffset)
                    {
                        byte lowHashcode = _parser.GetByte();
                        return(_parser.GetParserFromRelativeOffset());
                    }

                    if (_currentBucket >= _table._bucketMask)
                    {
                        return(new NativeParser());
                    }

                    _currentBucket++;
                    _parser = _table.GetParserForBucket(_currentBucket, out _endOffset);
                }
            }
Exemple #2
0
        public NativeHashtable(byte[] image, NativeParser parser)
        {
            uint header = parser.GetByte();

            _baseOffset = parser.Offset;
            _image      = image;

            int numberOfBucketsShift = (int)(header >> 2);

            if (numberOfBucketsShift > 31)
            {
                throw new System.BadImageFormatException();
            }
            _bucketMask = (uint)((1 << numberOfBucketsShift) - 1);

            byte entryIndexSize = (byte)(header & 3);

            if (entryIndexSize > 2)
            {
                throw new System.BadImageFormatException();
            }
            _entryIndexSize = entryIndexSize;
        }