Closed RazrFalcon closed 3 months ago
This seems like at least a little bit of a mistake. Without any detection of whether the native libm is available, you always get slow emulated versions of all these functions now. Though arguably, maybe that's something that can be fixed in the libm crate directly? Though that's hard to do without libm being part of the std / core / stdarch / ... set of crates, as that means it can't just lower to LLVM intrinsics.
Could we do:
#[cfg(not(feature = "std"))]
use core_maths::CoreFloat;
and something similar for ttf-parser
? Then, the core_maths
library only gets used when std
is explicitly disabled, while it uses the std
one when it's enabled? It will still be in the dependency tree when using std
, but it's still better than nothing.
nvm, the fact that it's a trait with the exact same method names as the ones in std
means that the inherent methods have higher priority in name resolution, so it should resolve to the std
methods automatically if they are available. Pretty nice solution, though not explicitly documented by them.
Yes, to my understanding the whole point behind core_maths
is that it does everything automatically.
I would prefer for it to skip libm
linking when std
is enabled. But well. Still better then the previous solution.
core_maths should simplify
no_std
build support. And while it has just one star, it is already used byskrifa
and other projects.