Fix no_std build

This fixes the `no_std` build and also makes sure it's tested properly
in the CI workflow.
This commit is contained in:
Christopher Serr 2024-02-12 17:34:28 +01:00 committed by Jeremy Soller
parent 0cb6eba6e7
commit 8582173128
8 changed files with 31 additions and 10 deletions

14
src/math.rs Normal file
View file

@ -0,0 +1,14 @@
#[cfg(not(feature = "std"))]
pub use libm::{roundf, truncf};
#[cfg(feature = "std")]
#[inline]
pub fn roundf(x: f32) -> f32 {
x.round()
}
#[cfg(feature = "std")]
#[inline]
pub fn truncf(x: f32) -> f32 {
x.trunc()
}