第八版

This commit is contained in:
YuWuKunCheng
2026-05-29 04:05:36 +08:00
parent ae57090d7f
commit 5c3179eec8
31 changed files with 4111 additions and 1730 deletions
+2
View File
@@ -26,8 +26,10 @@ pub mod bsp_type;
pub mod direction;
pub mod fractal;
pub mod gap;
pub mod sync_f64;
pub use bsp_type::;
pub use direction::;
pub use fractal::;
pub use gap::;
pub use sync_f64::SyncF64;
+25
View File
@@ -0,0 +1,25 @@
use std::sync::atomic::{AtomicU64, Ordering};
/// f64 原子类型 — 基于 AtomicU64 + 位转换,API 与 `Cell<f64>` 一致。
#[derive(Debug, Default)]
pub struct SyncF64(AtomicU64);
impl SyncF64 {
pub fn new(v: f64) -> Self {
Self(AtomicU64::new(v.to_bits()))
}
pub fn get(&self) -> f64 {
f64::from_bits(self.0.load(Ordering::Relaxed))
}
pub fn set(&self, v: f64) {
self.0.store(v.to_bits(), Ordering::Relaxed);
}
}
impl Clone for SyncF64 {
fn clone(&self) -> Self {
Self(AtomicU64::new(self.0.load(Ordering::Relaxed)))
}
}