Commit a73a9bf0 authored by Alex Butler's avatar Alex Butler

Fix no_std build

parent a562189b
......@@ -48,7 +48,7 @@ default = ["std"]
# Activates usage of std.
std = ["has-atomics", "ttf-parser/default", "ab_glyph_rasterizer/default"]
# Uses libm when not using std. This needs to be active in that case.
libm-math = ["libm"]
libm-math = ["libm", "ab_glyph_rasterizer/libm"]
# Some targets don't have atomics, this activates usage of Arc<T> instead of Rc<T>.
has-atomics = []
# Adds `gpu_cache` module
......
use core::ops;
#[cfg(all(feature = "libm-math", not(feature = "std")))]
use crate::nostd_float::FloatExt;
/// A point in 2-dimensional space, with each dimension of type `N`.
///
/// Legal operations on points are addition and subtraction by vectors, and
......
......@@ -114,8 +114,6 @@ use core::fmt;
#[cfg(all(feature = "libm-math", not(feature = "std")))]
use crate::nostd_float::FloatExt;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// Good enough relatively equal test for floats.
macro_rules! relative_eq {
......
pub(crate) trait FloatExt {
fn floor(self) -> Self;
fn ceil(self) -> Self;
fn sqrt(self) -> Self;
fn fract(self) -> Self;
fn trunc(self) -> Self;
fn round(self) -> Self;
......@@ -18,10 +17,6 @@ impl FloatExt for f32 {
libm::ceilf(self)
}
#[inline]
fn sqrt(self) -> Self {
libm::sqrtf(self)
}
#[inline]
fn fract(self) -> Self {
self - self.trunc()
}
......
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