aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2017-10-25 16:03:23 +0100
committerJon Skeet <skeet@pobox.com>2017-12-09 09:49:24 +0000
commitf3e9a65d758d47633a161e526b35dea22bac9a5c (patch)
treea1733195e76c088c2f83093910c92e4d5609d275 /csharp/src/Google.Protobuf/Collections/RepeatedField.cs
parent618f06fc9cd7fd872de8977dfe40294cadb4af21 (diff)
downloadprotobuf-f3e9a65d758d47633a161e526b35dea22bac9a5c.tar.gz
protobuf-f3e9a65d758d47633a161e526b35dea22bac9a5c.tar.bz2
protobuf-f3e9a65d758d47633a161e526b35dea22bac9a5c.zip
Compare floating point values bitwise in C#
This is the manual code part of the Google.Protobuf library, and tests. Some tests will fail until codegen is changed and rerun.
Diffstat (limited to 'csharp/src/Google.Protobuf/Collections/RepeatedField.cs')
-rwxr-xr-xcsharp/src/Google.Protobuf/Collections/RepeatedField.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
index 6063ff61..c18b63e2 100755
--- a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
+++ b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
@@ -51,6 +51,7 @@ namespace Google.Protobuf.Collections
, IReadOnlyList<T>
#endif
{
+ private static readonly EqualityComparer<T> EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer<T>();
private static readonly T[] EmptyArray = new T[0];
private const int MinArraySize = 8;
@@ -434,7 +435,7 @@ namespace Google.Protobuf.Collections
{
return false;
}
- EqualityComparer<T> comparer = EqualityComparer<T>.Default;
+ EqualityComparer<T> comparer = EqualityComparer;
for (int i = 0; i < count; i++)
{
if (!comparer.Equals(array[i], other.array[i]))
@@ -454,7 +455,7 @@ namespace Google.Protobuf.Collections
public int IndexOf(T item)
{
ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item));
- EqualityComparer<T> comparer = EqualityComparer<T>.Default;
+ EqualityComparer<T> comparer = EqualityComparer;
for (int i = 0; i < count; i++)
{
if (comparer.Equals(array[i], item))