Example #1
0
                public override int GetHashCode()
                {
                    int hash = Lim;

                    hash = Hashing.CombineHash(hash, ISrcCol);
                    for (int i = 0; i < Lim; ++i)
                    {
                        hash = Hashing.CombineHash(hash, (int)Grams[i]);
                    }
                    return(hash);
                }
Example #2
0
        public override int GetHashCode()
        {
            int hash = Hashing.CombinedHash(ItemType.GetHashCode(), Size);

            hash = Hashing.CombineHash(hash, Dimensions.Length);
            for (int i = 0; i < Dimensions.Length; i++)
            {
                hash = Hashing.CombineHash(hash, Dimensions[i].GetHashCode());
            }
            return(hash);
        }
Example #3
0
        public override int GetHashCode()
        {
            int hash  = Hashing.CombinedHash(_itemType.GetHashCode(), _size);
            int count = Utils.Size(_dims);

            hash = Hashing.CombineHash(hash, count.GetHashCode());
            for (int i = 0; i < count; i++)
            {
                hash = Hashing.CombineHash(hash, _dims[i].GetHashCode());
            }
            return(hash);
        }
            public int GetHashCode(ISet <DataKind> obj)
            {
                Contracts.AssertValueOrNull(obj);
                int hash = 0;

                if (obj != null)
                {
                    foreach (var kind in obj.OrderBy(x => x))
                    {
                        hash = Hashing.CombineHash(hash, kind.GetHashCode());
                    }
                }
                return(hash);
            }
Example #5
0
        private static ulong HashClass(Type type)
        {
            ulong hash = default;

            foreach (var field in type.GetFields(StaticFlags))
            {
                hash = Hashing.CombineHash(hash, field.GetValue(null).GetLongHashCode());
            }

            foreach (var child in type.GetNestedTypes(StaticFlags))
            {
                hash = Hashing.CombineHash(hash, HashClass(child));
            }

            return(hash);
        }
Example #6
0
        public ParameterSet(IEnumerable <IParameterValue> parameters)
        {
            _parameterValues = new Dictionary <string, IParameterValue>();
            foreach (var parameter in parameters)
            {
                _parameterValues.Add(parameter.Name, parameter);
            }

            var parameterNames = _parameterValues.Keys.ToList();

            parameterNames.Sort();
            _hash = 0;
            foreach (var parameterName in parameterNames)
            {
                _hash = Hashing.CombineHash(_hash, _parameterValues[parameterName].GetHashCode());
            }
        }
Example #7
0
        public override int GetHashCode()
        {
            int hash = 0x79B70F13;

            if (_root != null)
            {
                if (_hashCodeCache.ContainsKey(_root))
                {
                    hash = _hashCodeCache[_root];
                }
                else
                {
                    hash = Hashing.CombineHash(hash, _root.GetHashCode());
                }
            }

            return(hash);
        }
Example #8
0
        internal static ulong GetHash(SpriteInfo input, bool desprite)
        {
            // Need to make Hashing.CombineHash work better.
            ulong hash;

            if (!Config.Resample.EnableDynamicScale)
            {
                hash = Hashing.CombineHash(input.Reference.SafeName()?.GetHashCode(), input.Reference.Meta().GetHash(input));
            }
            else
            {
                hash = Hashing.CombineHash(input.Reference.SafeName()?.GetHashCode(), input.Reference.Meta().GetHash(input), HashULong(unchecked ((ulong)input.ExpectedScale)));
            }
            if (desprite)
            {
                hash = Hashing.CombineHash(hash, input.Size.Hash());
            }
            else
            {
            }
            return(hash);
        }
Example #9
0
 public override int GetHashCode()
 {
     return(Hashing.CombineHash(Height.GetHashCode(), Width.GetHashCode()));
 }
Example #10
0
 /// <summary>
 /// Produce the same hash code for map types with the same key type and the same value type.
 /// </summary>
 public override int GetHashCode()
 {
     return(Hashing.CombineHash(_keyType.GetHashCode(), _valueType.GetHashCode()));
 }
Example #11
0
 static private ulong SpriteHash(Texture2D texture, Bounds source, int expectedScale)
 {
     return(Hashing.CombineHash(ScaledTexture.ExcludeSprite(texture) ? 0UL : source.Hash(), expectedScale.GetHashCode()));
 }
 public override int GetHashCode()
 {
     return(Hashing.CombineHash(Type.GetHashCode(), Hashing.HashInt(IsRef.GetHashCode())));
 }
Example #13
0
 public int GetHashCode(KeyValuePair <int, T> obj)
 {
     return(Hashing.CombineHash(obj.Key, _tComparer.GetHashCode(obj.Value)));
 }
Example #14
0
 public override int GetHashCode()
 {
     return(Hashing.CombineHash(Type.GetHashCode(), Name.GetHashCode()));
 }
 public override int GetHashCode()
 {
     return(Hashing.CombineHash(_dateTime.GetHashCode(), _offset.GetHashCode()));
 }