Update libm -> 0.2.1

parent 10b8866e
Pipeline #6537 passed with stages
in 1 minute and 45 seconds
## Unreleased
* Update libm -> `0.2.1`.
## 0.3
* Support no-std usage by disabling new default feature `std`.
```rust
......
......@@ -13,7 +13,7 @@ exclude = ["/fonts/**"]
[dependencies]
byteorder = { version = "1.1", default-features = false }
libm = { version = "0.1.4", optional = true }
libm = { version = "0.2.1", optional = true }
[features]
default = ["std"]
......
......@@ -11,12 +11,32 @@ extern crate alloc;
use alloc::vec::Vec;
use byteorder::{BigEndian as BE, ByteOrder};
use core::ops::Deref;
#[cfg(all(feature = "libm", not(feature = "std")))]
use libm::F32Ext;
#[cfg(not(any(feature = "libm", feature = "std")))]
compile_error!("You need to activate either the `std` or `libm` feature.");
#[cfg(all(feature = "libm", not(feature = "std")))]
trait FloatExt {
fn floor(self) -> Self;
fn ceil(self) -> Self;
fn sqrt(self) -> Self;
}
#[cfg(all(feature = "libm", not(feature = "std")))]
impl FloatExt for f32 {
#[inline]
fn floor(self) -> Self {
libm::floorf(self)
}
#[inline]
fn ceil(self) -> Self {
libm::ceilf(self)
}
#[inline]
fn sqrt(self) -> Self {
libm::sqrtf(self)
}
}
#[derive(Copy, Clone, Debug)]
pub struct FontInfo<Data: Deref<Target = [u8]>> {
data: Data, // pointer to .ttf file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment