Esempio n. 1
0
        public static bool ContainsMinor(long[] array, int size, int value)
        {
            int low  = 0;
            int high = size - 1;

            while (low <= high)
            {
                int midIdx   = low + (high - low) / 2;
                int minorVal = Miscellanea.Low(array[midIdx]);

                if (minorVal < value)
                {
                    // midIdx is below the target range
                    low = midIdx + 1;
                }
                else if (minorVal > value)
                {
                    // midIdx is above the target range
                    high = midIdx - 1;
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
        //////////////////////////////////////////////////////////////////////////////

        private static void Flip(long[] array, int size)
        {
            for (int i = 0; i < size; i++)
            {
                long entry = array[i];
                array[i] = Miscellanea.Pack(Miscellanea.High(entry), Miscellanea.Low(entry));
            }
        }
Esempio n. 3
0
 private static int Index(long entry)
 {
     return(Miscellanea.Low(entry));
 }
Esempio n. 4
0
 static internal int Arg2(long tuple)
 {
     return(Miscellanea.Low(tuple));
 }