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

LowerMidpointBound() private method

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