Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify docs of macros #82

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ pub const fn primes_lt<const N: usize, const MEM: usize>(
Ok(primes)
}

/// Call [`primes_geq`] or [`primes_lt`], and automatically compute the memory requirement of the sieve.
/// Generate arrays of large prime numbers without having to store all primes
/// from 2 and up in the result, and thus potentially the binary.
///
/// Calls [`primes_geq`] or [`primes_lt`], and automatically computes the memory requirement of the sieve.
///
/// Compute `N` primes larger than or equal to some limit as `primes_segment!(N; >= LIMIT)`,
/// and `N` primes less than some limit as `primes_segment!(N; < LIMIT)`.
Expand All @@ -251,8 +254,10 @@ pub const fn primes_lt<const N: usize, const MEM: usize>(
/// # use const_primes::{primes_segment, GenerationError};
/// const N: usize = 3;
/// const LIMIT: u64 = 5_000_000_031;
///
/// const PRIMES_GEQ: Result<[u64; N], GenerationError> = primes_segment!(N; >= LIMIT);
/// const PRIMES_LT: Result<[u64; N], GenerationError> = primes_segment!(N; < LIMIT);
///
/// // Can also be used at runtime:
/// let primes_geq = primes_segment!(N; >= LIMIT);
///
Expand Down
5 changes: 4 additions & 1 deletion src/sieve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,10 @@ pub const fn sieve_geq<const N: usize, const MEM: usize>(
Ok(ans)
}

/// Call [`sieve_geq`] or [`sieve_lt`], and automatically compute the memory requirement of the sieve.
/// Generate arrays of the prime status of large numbers without having to store the prime status
/// of every single integer smaller than the target in the result, and thus potentially the binary.
///
/// Calls [`sieve_geq`] or [`sieve_lt`], and automatically computes the memory requirement of the sieve.
///
/// Sieve the `N` smallest numbers larger than or equal to some limit as `sieve_segment!(N; >= LIMIT)`,
/// and the `N` largest numbers smaller than some limit as `sieve_segment!(N; < LIMIT)`.
Expand Down