Welcome to mirror list, hosted at ThFree Co, Russian Federation.

InlineArrayType.Sorting.cs « IL « Interop « TypeSystem « Common « tools « coreclr « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ca637423c2cb20211bff40f20b399150dd80371c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Internal.TypeSystem.Interop
{
    // Functionality related to deterministic ordering of types
    internal partial class InlineArrayType
    {
        protected override int ClassCode => 226817075;

        protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
        {
            var otherType = (InlineArrayType)other;
            int result = (int)Length - (int)otherType.Length;
            if (result != 0)
                return result;

            return comparer.Compare(ElementType, otherType.ElementType);
        }

        private partial class InlineArrayMethod
        {
            protected override int ClassCode => -1303220581;

            protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
            {
                var otherMethod = (InlineArrayMethod)other;

                int result = _kind - otherMethod._kind;
                if (result != 0)
                    return result;

                return comparer.Compare(OwningType, otherMethod.OwningType);
            }
        }

        private partial class InlineArrayField
        {
            protected override int ClassCode => 1542668652;

            protected override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
            {
                var otherField = (InlineArrayField)other;

                return comparer.Compare(OwningType, otherField.OwningType);
            }
        }
    }
}