A cached prime number generator.
More...
#include <primes.h>
|
| #define | IteratorTail(return_type, struct_type) |
| | The base definition macro for all iterators in this project. More...
|
| |
| #define | IterationHead(it) |
| | The base macro for all iteration functions in this project. More...
|
| |
| #define | IteratorInitHead(advance, ...) {.iterator_function = &advance, AddDestructor(no_destructor), __VA_ARGS__} |
| | The base macro for all iterator initialization functions in this project. More...
|
| |
| #define | AddDestructor(func) ExtendInit(destructor, (void (*const)(void *)) &func) |
| | The extension macro for initializing Iterators with a destructor. More...
|
| |
| #define | ExtendInit(name, value) .name = value |
| | The extension macro for initializing more complicated Iterators. More...
|
| |
| #define | next(state) (*(state.iterator_function))(&state) |
| | The macro to advance generic iterators. More...
|
| |
| #define | next_p(state) (*(state->iterator_function))(state) |
| | The macro to advance generic iterator pointers. More...
|
| |
| #define | free_iterator(it) (*(it.destructor))(&it) |
| | The generic destructor for iterators. More...
|
| |
| #define | free_iterator_p(it) (*(it->destructor))(it) |
| | The generic destructor for iterator pointers. More...
|
| |
A cached prime number generator.
- Note
- If you will only use the prime numbers once in your program, use prime_sieve instead
The function to advance a prime number generator.
- Parameters
-
| pc | the counter you want to advance |
- Returns
- the next number in the iteration
The destructor for the prime number counter.
The simplest constructor for the prime number generator.
The base constructor for the prime number generator.
- Parameters
-
| stop | The point where the counter is exhausted |
| void(*const c::include::primes::prime_counter::destructor) (void *it) |
|
private |
| size_t c::include::primes::prime_counter::idx |
The current position of the counter.
| uintmax_t(*const c::include::primes::prime_counter::iterator_function) (prime_counter *it) |
|
private |
The pointer to the iteration function.
- See also
- next
A (currently unused) source for new prime numbers.
| uintmax_t c::include::primes::prime_counter::stop |
The point where the counter is exhausted.
The documentation for this struct was generated from the following file: