Example #1
0
        public static void And <T>(UnsafeHashSet *set, UnsafeHashSet *other) where T : unmanaged, IEquatable <T>
        {
            for (int i = set->_collection.UsedCount - 1; i >= 0; --i)
            {
                var entry = UnsafeHashCollection.GetEntry(&set->_collection, i);
                if (entry->State == UnsafeHashCollection.EntryState.Used)
                {
                    var key     = *(T *)((byte *)entry + set->_collection.KeyOffset);
                    var keyHash = key.GetHashCode();

                    // if we don't find this in other collection, remove it (And)
                    if (UnsafeHashCollection.Find <T>(&other->_collection, key, keyHash) == null)
                    {
                        UnsafeHashCollection.Remove <T>(&set->_collection, key, keyHash);
                    }
                }
            }
        }
Example #2
0
 public static bool Remove <K>(UnsafeHashMap *map, K key) where K : unmanaged, IEquatable <K>
 {
     return(UnsafeHashCollection.Remove <K>(&map->_collection, key, key.GetHashCode()));
 }
Example #3
0
 public static bool Remove <T>(UnsafeHashSet *set, T key) where T : unmanaged, IEquatable <T>
 {
     return(UnsafeHashCollection.Remove <T>(&set->_collection, key, key.GetHashCode()));
 }