Skip to content

Commit

Permalink
radix: refactor (1/N: add generic variant for Radix)
Browse files Browse the repository at this point in the history
  • Loading branch information
ognevny committed Dec 29, 2024
1 parent 17a6d01 commit 7e1e5e0
Show file tree
Hide file tree
Showing 3 changed files with 900 additions and 675 deletions.
7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ rust-version = "1.81.0"
[dependencies]
cfg-if = "1.0"
fastrand = { version = "2.2", default-features = false }
# FIXME: use std isqrt after rust 1.84.0 release
integer-sqrt = "0.1"
num-bigint = { version = "0.4", default-features = false }
rayon = { version = "1.10", optional = true }
regex = { version = "1.11", default-features = false }

[dependencies.snafu]
version = "0.8.5"
default-features = false
features = ["rust_1_81"]
thiserror = { version = "2.0", default-features = false }

[features]
default = ["std"]
Expand Down
6 changes: 3 additions & 3 deletions src/algorithm/prime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

use {
crate::num::power::modpow, fastrand::Rng, integer_sqrt::IntegerSquareRoot as _,
num_bigint::BigUint, snafu::Snafu,
num_bigint::BigUint, thiserror::Error,
};

/// If number is less than 2, we can't say that number is either prime or composite.
#[non_exhaustive]
#[derive(Debug, Snafu, PartialEq, Eq, Clone, Copy)]
#[snafu(display("This number is neither prime nor composite"))]
#[derive(Debug, Error, PartialEq, Eq, Clone, Copy)]
#[error("This number is neither prime nor composite")]
pub struct PrimeStatusError;

#[non_exhaustive]
Expand Down
Loading

0 comments on commit 7e1e5e0

Please sign in to comment.