pub struct AtomicF64(/* private fields */);Expand description
An f64 stored as its bit pattern in an AtomicU64, supporting lock-free
updates via a CAS loop. Salmon updates per-transcript mass and the fragment
length distribution concurrently from worker threads; this is the building
block for that.
Implementations§
Source§impl AtomicF64
impl AtomicF64
pub fn new(v: f64) -> Self
pub fn load(&self) -> f64
pub fn store(&self, v: f64)
Sourcepub fn fetch_update<F: Fn(f64) -> f64>(&self, f: F) -> f64
pub fn fetch_update<F: Fn(f64) -> f64>(&self, f: F) -> f64
Atomically replace the stored value with f(current), returning the new value.
Sourcepub fn log_add_assign(&self, log_inc: f64)
pub fn log_add_assign(&self, log_inc: f64)
Atomically accumulate log_inc into the stored log-space value:
self = log(exp(self) + exp(log_inc)). Mirrors salmon’s incLoopLog.
Sourcepub fn add_assign(&self, inc: f64)
pub fn add_assign(&self, inc: f64)
Atomically add inc in linear space. Mirrors salmon’s incLoop.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AtomicF64
impl RefUnwindSafe for AtomicF64
impl Send for AtomicF64
impl Sync for AtomicF64
impl Unpin for AtomicF64
impl UnsafeUnpin for AtomicF64
impl UnwindSafe for AtomicF64
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more