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

ArrayType.Sorting.cs « Sorting « TypeSystem « Common « tools « coreclr « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 30993214e5d6816ad6a0f845ad3a10c69811153e (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
// 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
{
    // Functionality related to deterministic ordering of types
    partial class ArrayType
    {
        protected internal override int ClassCode => -1274559616;

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

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

    partial class ArrayMethod
    {
        protected internal override int ClassCode => 487354154;

        protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
        {
            var otherMethod = (ArrayMethod)other;
            int result = _kind - otherMethod._kind;
            if (result != 0)
                return result;

            return comparer.CompareWithinClass(OwningArray, otherMethod.OwningArray);
        }
    }
}