Skip to content

Commit

Permalink
make libm an optional dependency
Browse files Browse the repository at this point in the history
It still needs to be turned on whenever building for no_std.
  • Loading branch information
Robbepop committed Sep 29, 2019
1 parent 4a0f4c8 commit 987843c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ specialized-div-rem = { version = "0.0.5", optional = true }
rand = { version = "0.7", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
# Currently needed because of: https://github.com/rust-lang/rfcs/issues/2505
libm = { version = "0.1", default-features = false }
libm = { version = "0.1", default-features = false, optional = true }

[dev-dependencies]
serde_test = "1.0"
itertools = "0.8"
rand_xorshift = "0.2"

[features]
default = ["rand_support", "serde_support", "specialized-div-rem", "std"]
default = [
"rand_support",
"serde_support",
"specialized-div-rem",
"std",
"libm_0",
]
std = [
"smallvec/std",
"rand/std",
Expand All @@ -39,6 +45,8 @@ rand_support = [
"rand/getrandom",
]
serde_support = ["serde"]
# Usage of libm is required for `no_std` builds.
libm_0 = ["libm"]

[badges]
travis-ci = { repository = "Robbepop/apint" }
Expand Down
1 change: 1 addition & 0 deletions src/apint/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ impl ApInt {
Digit,
DigitRepr,
};
#[cfg(feature = "libm_0")]
use libm::F64Ext as _;

debug_assert!(!v.is_empty() && !radix.is_power_of_two());
Expand Down

0 comments on commit 987843c

Please sign in to comment.