EventStore.Core.Index.PTable.UpperMidpointBound C# (CSharp) Method

UpperMidpointBound() private method

private UpperMidpointBound ( Midpoint midpoints, IndexEntryKey key ) : long
midpoints Midpoint
key IndexEntryKey
return long
        private long UpperMidpointBound(Midpoint[] midpoints, IndexEntryKey key)
        {
            long l = 0;
            long r = midpoints.Length - 1;
            while (l < r)
            {
                long m = l + (r - l) / 2;
                if (midpoints[m].Key.SmallerThan(key))
                    r = m;
                else
                    l = m + 1;
            }
            return r;
        }