Skip to content

Commit 0c32ff3

Browse files
committed
Revert "[OpenTelemetry] Metrics - beter handling for double.NaN (#7072)"
This reverts commit a1b6e6a.
1 parent a21f062 commit 0c32ff3

2 files changed

Lines changed: 2 additions & 34 deletions

File tree

src/OpenTelemetry/Internal/InterlockedHelper.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static void Add(ref double location, double value)
1616
var currentValue = Volatile.Read(ref location);
1717

1818
var returnedValue = Interlocked.CompareExchange(ref location, currentValue + value, currentValue);
19-
if (!AreSame(returnedValue, currentValue))
19+
if (returnedValue != currentValue)
2020
{
2121
AddRare(ref location, value, returnedValue);
2222
}
@@ -35,16 +35,12 @@ private static void AddRare(ref double location, double value, double currentVal
3535
sw.SpinOnce();
3636

3737
var returnedValue = Interlocked.CompareExchange(ref location, currentValue + value, currentValue);
38-
if (AreSame(returnedValue, currentValue))
38+
if (returnedValue == currentValue)
3939
{
4040
break;
4141
}
4242

4343
currentValue = returnedValue;
4444
}
4545
}
46-
47-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
48-
private static bool AreSame(double left, double right)
49-
=> BitConverter.DoubleToInt64Bits(left) == BitConverter.DoubleToInt64Bits(right);
5046
}

test/OpenTelemetry.Tests/Internal/InterlockedHelperTests.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)