Skip to content

Commit 1bd7ced

Browse files
committed
Optimize PackedTuple.GetHashCode()
1 parent 2e439fc commit 1bd7ced

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Orm/Xtensive.Orm/Tuples/Packed/PackedTuple.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2012 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2003-2022 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Denis Krjuchkov
55
// Created: 2012.12.29
66

@@ -68,10 +68,9 @@ public override int GetHashCode()
6868
int result = 0;
6969
for (int i = 0; i < count; i++) {
7070
ref var descriptor = ref fieldDescriptors[i];
71-
var accessor = descriptor.Accessor;
72-
var state = GetFieldState(ref fieldDescriptors[i]);
73-
var fieldHash = state==TupleFieldState.Available
74-
? accessor.GetValueHashCode(this, ref descriptor)
71+
var state = GetFieldState(ref descriptor);
72+
var fieldHash = state == TupleFieldState.Available
73+
? descriptor.Accessor.GetValueHashCode(this, ref descriptor)
7574
: 0;
7675
result = HashCodeMultiplier * result ^ fieldHash;
7776
}

0 commit comments

Comments
 (0)