forked from rust-num/num-bigint
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* no_std support * Use integer log2 when possible to estimate allocations * Remove std features from a few dependencies * Use libm for missing funcs in nostd environment * Use autocfg to detect presence of i128 * Better CI test for nostd environment * Move benchmark to a separate crate * Make the tests pass in no_std builds * Use thumbv7m target for nostd build test * Add documentation about the no-std compatibility * Make zeroize and prime features no_std-compatible * Test each feature in nostd context * Fix mac test to work in no_std environment * Avoid using thread_rng in nostd tests * Fix prime tests in nostd mode * Fix all warnings and errors * Only test nostd builds on nightly on travis * Travis: Only do nostd builds on nightly
- Loading branch information
1 parent
688ad82
commit 874ab0f
Showing
34 changed files
with
240 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "num-bigint-dig-benchmark" | ||
version = "0.0.0" | ||
autobenches = false | ||
publish = false | ||
|
||
[[bench]] | ||
harness = false | ||
name = "bench_main" | ||
|
||
[dependencies] | ||
num-bigint-dig = { path = "../", features = ["prime", "rand"] } | ||
num-integer = "0.1.39" | ||
num-traits = "0.2.4" | ||
rand = "0.6" | ||
rand_chacha = "0.1" | ||
|
||
[dev-dependencies] | ||
criterion = "0.2" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
benches/benchmarks/roots.rs → benchmark_crate/benches/benchmarks/roots.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#![cfg(feature = "rand")] | ||
|
||
use criterion::Criterion; | ||
use num_bigint::{BigUint, RandBigInt}; | ||
use num_traits::Pow; | ||
|
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,12 @@ | ||
extern crate autocfg; | ||
use std::env; | ||
use std::io::Write; | ||
use std::process::{Command, Stdio}; | ||
|
||
fn main() { | ||
if probe("fn main() { 0i128; }") { | ||
let ac = autocfg::new(); | ||
|
||
if ac.probe_type("i128") { | ||
println!("cargo:rustc-cfg=has_i128"); | ||
} else if env::var_os("CARGO_FEATURE_I128").is_some() { | ||
panic!("i128 support was not detected!"); | ||
} | ||
} | ||
|
||
/// Test if a code snippet can be compiled | ||
fn probe(code: &str) -> bool { | ||
let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into()); | ||
let out_dir = env::var_os("OUT_DIR").expect("environment variable OUT_DIR"); | ||
|
||
let mut child = Command::new(rustc) | ||
.arg("--out-dir") | ||
.arg(out_dir) | ||
.arg("--emit=obj") | ||
.arg("-") | ||
.stdin(Stdio::piped()) | ||
.spawn() | ||
.expect("rustc probe"); | ||
|
||
child | ||
.stdin | ||
.as_mut() | ||
.expect("rustc stdin") | ||
.write_all(code.as_bytes()) | ||
.expect("write rustc stdin"); | ||
|
||
child.wait().expect("rustc probe").success() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use std::borrow::Cow; | ||
use alloc::borrow::Cow; | ||
|
||
use num_traits::{One, Signed}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use std::borrow::Cow; | ||
use alloc::borrow::Cow; | ||
|
||
use num_traits::Zero; | ||
use smallvec::SmallVec; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.