namespace Unosquare.Swan
{
using System;
using Abstractions;
///
/// Fast, atomic double combining interlocked to write value and volatile to read values.
///
public sealed class AtomicDouble : AtomicTypeBase
{
///
/// Initializes a new instance of the class.
///
/// if set to true [initial value].
public AtomicDouble(double initialValue = default)
: base(BitConverter.DoubleToInt64Bits(initialValue))
{
// placeholder
}
///
protected override double FromLong(long backingValue) =>
BitConverter.Int64BitsToDouble(backingValue);
///
protected override long ToLong(double value) =>
BitConverter.DoubleToInt64Bits(value);
}
}