BinarySearch() private static method

private static BinarySearch ( Bound bounds, int count, ushort value ) : int
bounds Bound
count int
value ushort
return int
Example #1
0
        private void Query(out int lowerQueryOut, out int upperQueryOut, ushort lowerValue, ushort upperValue, Bound[] bounds, int boundCount, int axis)
        {
            int num  = BroadPhase.BinarySearch(bounds, boundCount, lowerValue);
            int num2 = BroadPhase.BinarySearch(bounds, boundCount, upperValue);

            for (int i = num; i < num2; i++)
            {
                if (bounds[i].IsLower)
                {
                    this.IncrementOverlapCount((int)bounds[i].ProxyId);
                }
            }
            if (num > 0)
            {
                int i    = num - 1;
                int num3 = (int)bounds[i].StabbingCount;
                while (num3 != 0)
                {
                    Box2DXDebug.Assert(i >= 0);
                    if (bounds[i].IsLower)
                    {
                        Proxy proxy = this._proxyPool[(int)bounds[i].ProxyId];
                        if (num <= (int)proxy.UpperBounds[axis])
                        {
                            this.IncrementOverlapCount((int)bounds[i].ProxyId);
                            num3--;
                        }
                    }
                    i--;
                }
            }
            lowerQueryOut = num;
            upperQueryOut = num2;
        }