| 1 |
/* Finding the next prime >= a given small integer. |
| 2 |
Copyright (C) 1995-2026 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is free software: you can redistribute it and/or modify |
| 5 |
it under the terms of the GNU Lesser General Public License as |
| 6 |
published by the Free Software Foundation; either version 2.1 of the |
| 7 |
License, or (at your option) any later version. |
| 8 |
|
| 9 |
This file is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU Lesser General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU Lesser General Public License |
| 15 |
along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 16 |
|
| 17 |
#ifndef _GL_NEXT_PRIME_H |
| 18 |
#define _GL_NEXT_PRIME_H |
| 19 |
|
| 20 |
/* This file uses _GL_ATTRIBUTE_CONST. */ |
| 21 |
#if !_GL_CONFIG_H_INCLUDED |
| 22 |
#error "Please include config.h first." |
| 23 |
#endif |
| 24 |
|
| 25 |
#include <stddef.h> |
| 26 |
|
| 27 |
#ifdef __cplusplus |
| 28 |
extern "C" { |
| 29 |
#endif |
| 30 |
|
| 31 |
|
| 32 |
/* Round a given CANDIDATE number up to the nearest prime, and return that |
| 33 |
prime. Primes lower than 10 are merely skipped. */ |
| 34 |
extern size_t _GL_ATTRIBUTE_CONST next_prime (size_t candidate); |
| 35 |
|
| 36 |
|
| 37 |
#ifdef __cplusplus |
| 38 |
} |
| 39 |
#endif |
| 40 |
|
| 41 |
#endif /* _GL_NEXT_PRIME_H */ |