using System; using Unosquare.Swan.Abstractions; namespace Unosquare.Swan { /// /// 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(Int64 backingValue) => BitConverter.Int64BitsToDouble(backingValue); /// protected override Int64 ToLong(Double value) => BitConverter.DoubleToInt64Bits(value); } }