29 lines
765 B
C
29 lines
765 B
C
//
|
|
// Created by Kyle Stevenson on 01/02/2025.
|
|
//
|
|
|
|
#ifndef PRIME_SIEVES_H
|
|
#define PRIME_SIEVES_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sqlite3.h>
|
|
|
|
#include "bit_operations.h"
|
|
|
|
|
|
/**
|
|
* @brief Implements the Sieve of Eratosthenes algorithm using bitwise operations.
|
|
*
|
|
* This function efficiently finds all prime numbers up to a given limit by using a bit array.
|
|
* Each number is represented by a single bit, significantly reducing memory usage compared
|
|
* to a traditional boolean array.
|
|
*
|
|
* @param maxBits The upper bound (inclusive) up to which prime numbers are computed.
|
|
* @param dbFile The path to the SQLite database file.
|
|
*
|
|
*/
|
|
void sieveOfEratosthenes(const size_t maxBits, const char *dbFile);
|
|
|
|
#endif //PRIME_SIEVES_H
|