예제 #1
0
        private int SearchLevelTwo(Sha sha, int index)
        {
            int[] data = shas[index];

            int high = offsets[index].Length >> 2;

            if (high == 0)
            {
                return(-1);
            }

            int low = 0;

            while (low < high)
            {
                int mid  = (low + high) >> 1;
                int mid4 = mid << 2;
                int cmp;

                cmp = sha.CompareTo(data, mid4 + mid);
                if (cmp < 0)
                {
                    high = mid;
                }
                else if (cmp == 0)
                {
                    return(mid);
                }
                else
                {
                    low = mid + 1;
                }
            }


            return(-1);
        }