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:
parent
0cb6eba6e7
commit
8582173128
8 changed files with 31 additions and 10 deletions
14
src/math.rs
Normal file
14
src/math.rs
Normal 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()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue