Go to the documentation of this file.
42 int n, k = 2, i, last, sqrt_of_n;
43 Size resultsWritten = 0;
57 for (i = 0; i < n; i++)
98 Size & resultsWritten,
99 const Size offsetNumber)
const
106 for (
int i = 0; i < n; i++)
110 output <<
" " << (i + offsetNumber);
114 if (resultsWritten >= 32)
139 for (i = 2; i < n; i++)
145 for (j = i + 1; j < n; j++)
virtual Result output(const char *string) const
Print text to output.
u32 sqrt(u32 number)
Compute the square root of a number.
ssize_t write(int fildes, const void *buf, size_t nbyte)
Write on a file.
C int errno
The lvalue errno is used by many functions to return error values.
C int atoi(const char *nptr)
Convert a string to an integer.
POSIX-compatible application.
const ArgumentContainer & arguments() const
Get program arguments.
void setDescription(const String &desc)
Set program description.
C void * malloc(size_t size)
A memory allocator.
char * strerror(int errnum)
The strerror function maps the number in errnum to a message string.
#define NULL
NULL means zero.
virtual Result exec()
Execute the application.
unsigned int Size
Any sane size indicator cannot go negative.
Result registerFlag(char arg, const char *name, const char *description)
Register a flag Argument.
Result reportResult(const int n, const u8 *map, Size &resultsWritten, const Size offsetNumber=0) const
Report the calculated results.
Result registerPositional(const char *name, const char *description, Size count=1)
Register a positional argument.
ArgumentParser & parser()
Get program arguments parser.
virtual ~SievePrime()
Destructor.
#define ERROR(msg)
Output an error message.
unsigned char u8
Unsigned 8-bit number.
Result searchSequential(const int n, u8 *map) const
Perform sequential search for prime numbers.
SievePrime(int argc, char **argv)
Constructor.