-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from JamesHallowell/typesafe-endpoints
Add type safety to endpoints
- Loading branch information
Showing
17 changed files
with
1,399 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
*.dylib | ||
/cmaj | ||
.env | ||
cmake-build-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use std::sync::atomic::{AtomicU32, AtomicU64, Ordering}; | ||
|
||
#[derive(Default)] | ||
pub struct AtomicF32(AtomicU32); | ||
|
||
impl AtomicF32 { | ||
pub fn load(&self, order: Ordering) -> f32 { | ||
f32::from_bits(self.0.load(order)) | ||
} | ||
|
||
pub fn store(&self, value: f32, order: Ordering) { | ||
self.0.store(value.to_bits(), order); | ||
} | ||
} | ||
|
||
#[derive(Default)] | ||
pub struct AtomicF64(AtomicU64); | ||
|
||
impl AtomicF64 { | ||
pub fn load(&self, order: Ordering) -> f64 { | ||
f64::from_bits(self.0.load(order)) | ||
} | ||
|
||
pub fn store(&self, value: f64, order: Ordering) { | ||
self.0.store(value.to_bits(), order); | ||
} | ||
} |
Oops, something went wrong.