natix.CompactDS.GGMN.Rank1 C# (CSharp) Method

Rank1() public method

public Rank1 ( int pos ) : int
pos int
return int
        public override int Rank1(int pos)
        {
            if (pos < 0) {
                return 0;
            }
            int posindex = pos >> 5;
            int absindex = posindex / this.B - 1;
            if (absindex < 0) {
                return BitAccess.Rank1 (this.BitBlocks, 0, posindex, pos - (posindex << 5));
            } else {
                int abs = (int)this.Abs [absindex];
                int startindex = (absindex + 1) * this.B;
                //try {
                    return abs + BitAccess.Rank1 (this.BitBlocks, startindex, posindex - startindex, pos - (posindex << 5));
            //				} catch (Exception e) {
            //					Console.WriteLine ("xxxxxxxx> pos: {0}, posindex: {1}, absindex: {2}", pos, posindex, absindex);
            //					Console.WriteLine ("xxxxxxxx> Abs.Count: {0}, n: {1}", this.Abs.Count, this.Count);
            //					Console.WriteLine ("xxxxxxxx> abs-rank: {0}, seq-start-index: {1}", abs, startindex);
            //					Console.WriteLine (e.StackTrace);
            //					throw e;
            //				}

            }
        }