示例#1
0
        internal static ulong GetMinOffset(ReferenceSequence refSeq, int begin)
        {
            int bin = BinUtilities.FirstBin(Constants.NumLevels) + (begin >> Constants.MinShift);

            do
            {
                if (refSeq.IdToChunks.ContainsKey(bin))
                {
                    break;
                }

                int firstBin = (BinUtilities.ParentBin(bin) << 3) + 1;

                if (bin > firstBin)
                {
                    bin--;
                }
                else
                {
                    bin = BinUtilities.ParentBin(bin);
                }
            } while (bin != 0);

            int bottomBin = BinUtilities.BottomBin(bin);

            return(refSeq.LinearFileOffsets[bottomBin]);
        }
示例#2
0
        internal static ulong GetMaxOffset(ReferenceSequence refSeq, int end)
        {
            int bin = BinUtilities.FirstBin(Constants.NumLevels) + ((end - 1) >> Constants.MinShift) + 1;

            while (true)
            {
                while (bin % 8 == 1)
                {
                    bin = BinUtilities.ParentBin(bin);
                }

                if (bin == 0)
                {
                    return(ulong.MaxValue);
                }
                if (refSeq.IdToChunks.TryGetValue(bin, out var chunks) && chunks.Length > 0)
                {
                    return(chunks[0].Begin);
                }

                bin++;
            }
        }