예제 #1
0
        internal bool TryGetNextValue(out TValue item, ref BlobMultiHashMapIterator <TKey> it)
        {
            int index = it.nextIndex;

            it.nextIndex = -1;
            item         = default;

            if (index < 0 /*|| index >= keyCapacity*/)
            {
                return(false);
            }

            while (!keys[index].Equals(it.key))
            {
                index = next[index];
                if (index < 0 /*|| index >= keyCapacity*/)
                {
                    return(false);
                }
            }

            it.nextIndex = next[index];
            item         = values[index];
            return(true);
        }
예제 #2
0
        internal int                bucketCapacityMask; // == buckets.Length - 1

        internal bool TryGetFirstValue(TKey key, out TValue item, out BlobMultiHashMapIterator <TKey> it)
        {
            it.key = key;

            // ReSharper disable once Unity.BurstAccessingManagedMethod
            int bucket = key.GetHashCode() & bucketCapacityMask;

            it.nextIndex = buckets[bucket];
            return(TryGetNextValue(out item, ref it));
        }