4 using System.Collections.Generic;
6 namespace SiliconStudio.
Paradox.Games
14 public static int LowerBound<TItem>(
this List<TItem> list, TItem value,
IComparer<TItem> comparer,
int index,
int count)
18 int half =
count >> 1;
19 int middle = index + half;
20 if (comparer.Compare(list[middle], value) < 0)
32 public static int UpperBound<TItem>(
this List<TItem> list, TItem value,
IComparer<TItem> comparer,
int index,
int count)
36 int half =
count >> 1;
37 int middle = index + half;
38 if (comparer.Compare(value, list[middle]) >= 0)
Helper functions to determine lower and upper bounds in a sorted list.