Пример #1
0
 public override int Advance(int target)
 {
     Debug.Assert(target > DocID_Renamed);
     if (NextDocs[BLOCK_SIZE - 1] < target)
     {
         // not in the next block, now use the index
         int index  = ForwardBinarySearch(target);
         int offset = (int)Offsets.Get(index);
         if (offset > this.Offset)
         {
             this.Offset   = offset;
             DocID_Renamed = (int)DocIDs.Get(index) - 1;
             BlockIdx      = index * IndexInterval - 1;
             while (true)
             {
                 DecompressBlock();
                 if (NextDocs[BLOCK_SIZE - 1] >= target)
                 {
                     break;
                 }
                 DocID_Renamed = NextDocs[BLOCK_SIZE - 1];
             }
             i = 0;
         }
     }
     return(SlowAdvance(target));
 }
Пример #2
0
        public byte[] Serialize(VMBody body, VMInstruction instruction, Offsets helper)
        {
            var buf = new byte[5];

            buf[0] = (byte)VMOpCode.Je;
            Array.Copy(BitConverter.GetBytes(helper.Get((int)instruction.Operand)), 0, buf, 1, 4);
            return(buf);
        }