Exemple #1
0
        ////////////////////////////////////////////////////////////////////////////

        bool ColsAreKey(Index index, int col1, int col2)
        {
            int[]  hashtable = index.hashtable;
            long[] bucket    = new long[32];

            for (int i = 0; i < hashtable.Length; i++)
            {
                int count = 0;

                int idx = hashtable[i];
                while (idx != Empty)
                {
                    int  offset     = 3 * idx;
                    long arg1       = flatTuples[offset + col1];
                    long arg2       = flatTuples[offset + col2];
                    long packedArgs = arg1 | (arg2 << 32);
                    Debug.Assert(arg1 == (packedArgs & 0xFFFFFFFFL));
                    Debug.Assert(arg2 == Miscellanea.UnsignedLeftShift64(packedArgs, 32));
                    bucket = Array.Append(bucket, count++, packedArgs);
                    idx    = index.Next(idx);
                }

                if (count > 1)
                {
                    if (count > 2)
                    {
                        Array.Sort(bucket, count);
                    }
                    long last = bucket[0];
                    for (int j = 1; j < count; j++)
                    {
                        long val = bucket[j];
                        if (val == last)
                        {
                            return(false);
                        }
                        last = val;
                    }
                }
            }

            return(true);
        }
Exemple #2
0
 public static int High(long slot)
 {
     return((int)Miscellanea.UnsignedLeftShift64(slot, 32));
 }