Ejemplo n.º 1
0
        /// <inheritdoc/>
        protected override void AddToHashCode(ref HashCode hashCode, FieldInfo obj)
        {
            switch (obj)
            {
            case Resource resource:
                hashCode.Add(resource.FieldName);
                hashCode.Add(resource.TypeName);
                hashCode.Add(resource.Offset);
                break;

            case Primitive primitive:
                hashCode.AddRange(primitive.FieldPath);
                hashCode.Add(primitive.TypeName);
                hashCode.Add(primitive.Offset);
                break;

            case NonLinearMatrix matrix:
                hashCode.AddRange(matrix.FieldPath);
                hashCode.Add(matrix.TypeName);
                hashCode.Add(matrix.ElementName);
                hashCode.Add(matrix.Rows);
                hashCode.Add(matrix.Columns);
                hashCode.AddRange(matrix.Offsets);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, HlslMethodSourceInfo obj)
 {
     hashCode.Add(obj.MetadataName);
     hashCode.Add(obj.EntryPoint);
     hashCode.AddRange(obj.DefinedTypes);
     hashCode.AddRange(obj.DefinedConstants);
     hashCode.AddRange(obj.DependentMethods);
 }
        protected override int VisitNew(NewExpression n)
        {
            var hc = new HashCode();

            hc.Add(n.Constructor);
            hc.AddRange(n.Members);
            hc.AddRange(n.Arguments.Select(Visit));
            return(hc.ToHashCode());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Combines hash codes of the elements of a specified sequence.
        /// </summary>
        /// <typeparam name="T">The sequence element type.</typeparam>
        /// <param name="source">The sequence of elements. The sequence itself can be <c>null</c>, and it can contain elements that are <c>null</c>.</param>
        /// <returns>The combined hash code.</returns>
        public static int SequenceCombine <T>(IEnumerable <T> source)
        {
            var hc = new HashCode();

            hc.AddRange(source);
            return(hc.ToHashCode());
        }
Ejemplo n.º 5
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, HierarchyInfo obj)
 {
     hashCode.Add(obj.FilenameHint);
     hashCode.Add(obj.FullyQualifiedMetadataName);
     hashCode.Add(obj.Namespace);
     hashCode.AddRange(obj.Hierarchy);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Combines hash codes of the elements of a specified sequence by using a specified <see cref="IEqualityComparer{T}"/>.
        /// </summary>
        /// <typeparam name="T">The sequence element type.</typeparam>
        /// <param name="source">The sequence of elements. The sequence itself can be <c>null</c>, and it can contain elements that are <c>null</c>.</param>
        /// <param name="comparer">The equality comparer to get element hash codes from.</param>
        /// <returns>The combined hash code.</returns>
        public static int SequenceCombine <T>(IEnumerable <T> source, IEqualityComparer <T> comparer)
        {
            var hc = new HashCode();

            hc.AddRange(source, comparer);
            return(hc.ToHashCode());
        }
Ejemplo n.º 7
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, DispatchDataInfo obj)
 {
     hashCode.Add(HierarchyInfo.Comparer.Default.GetHashCode(obj.Hierarchy));
     hashCode.Add(obj.Type);
     hashCode.AddRange(obj.FieldInfos, FieldInfo.Comparer.Default);
     hashCode.Add(obj.ResourceCount);
     hashCode.Add(obj.Root32BitConstantCount);
 }
Ejemplo n.º 8
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, HlslShaderSourceInfo obj)
 {
     hashCode.Add(obj.HeaderAndThreadsX);
     hashCode.Add(obj.ThreadsY);
     hashCode.Add(obj.ThreadsZ);
     hashCode.Add(obj.Defines);
     hashCode.Add(obj.StaticFieldsAndDeclaredTypes);
     hashCode.Add(obj.CapturedFieldsAndResourcesAndForwardDeclarations);
     hashCode.Add(obj.CapturedMethods);
     hashCode.Add(obj.EntryPoint);
     hashCode.Add(obj.ImplicitTextureType);
     hashCode.Add(obj.IsSamplerUsed);
     hashCode.AddRange(obj.DefinedTypes);
     hashCode.AddRange(obj.DefinedConstants);
     hashCode.AddRange(obj.MethodSignatures);
     hashCode.AddRange(obj.Delegates);
 }
        protected override int VisitInvocation(InvocationExpression i)
        {
            var hc = new HashCode();

            hc.AddRange(i.Arguments.Select(Visit));
            hc.Add(Visit(i.Expression));
            return(hc.ToHashCode());
        }
        /// <inheritdoc/>
        public int GetHashCode(ImmutableArray <T> obj)
        {
            HashCode hashCode = default;

            hashCode.AddRange(obj, this.comparer);

            return(hashCode.ToHashCode());
        }
        protected override int VisitMethodCall(MethodCallExpression mc)
        {
            var hc = new HashCode();

            hc.Add(Visit(mc.Object));
            hc.Add(mc.Method);
            hc.AddRange(mc.Arguments.Select(Visit));
            return(hc.ToHashCode());
        }
        protected override int VisitLambda(LambdaExpression l)
        {
            _Parameters.AddRange(l.Parameters);

            var hc = new HashCode();

            hc.AddRange(l.Parameters.Select(Visit));
            hc.Add(Visit(l.Body));
            return(hc.ToHashCode());
        }
        protected override int VisitListInit(ListInitExpression li)
        {
            var hc = new HashCode();

            hc.Add(VisitNew(li.NewExpression));
            foreach (var i in li.Initializers)
            {
                hc.Add(i.AddMethod);
                hc.AddRange(i.Arguments.Select(Visit));
            }
            return(hc.ToHashCode());
        }
Ejemplo n.º 14
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, DispatchMetadataInfo obj)
 {
     hashCode.Add(obj.Root32BitConstantCount);
     hashCode.Add(obj.IsSamplerUsed);
     hashCode.AddRange(obj.ResourceDescriptors);
 }
Ejemplo n.º 15
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, DispatchDataInfo obj)
 {
     hashCode.AddRange(obj.FieldInfos, FieldInfo.Comparer.Default);
     hashCode.Add(obj.Root32BitConstantCount);
 }
Ejemplo n.º 16
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, InputDescriptionsInfo obj)
 {
     hashCode.AddRange(obj.InputDescriptions);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     return(HashCode.AddRange(this));
 }
Ejemplo n.º 18
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, InputTypesInfo obj)
 {
     hashCode.AddRange(obj.InputTypes);
 }
Ejemplo n.º 19
0
 /// <inheritdoc cref="AddRange{TElement}(HashCode, IEnumerable{TElement}, IEqualityComparer{TElement})"/>
 public static void AddRange <TElement>(this HashCode hashCode, IEnumerable <TElement> source)
 => hashCode.AddRange(source, EqualityComparer <TElement> .Default);
Ejemplo n.º 20
0
 /// <inheritdoc/>
 protected override void AddToHashCode(ref HashCode hashCode, DispatchIdInfo obj)
 {
     hashCode.AddRange(obj.Delegates);
 }