1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 #ifndef __LINUX_PRIME_NUMBERS_H 3 #define __LINUX_PRIME_NUMBERS_H 4 5 #include <linux/types.h> 6 7 bool is_prime_number(unsigned long x); 8 unsigned long next_prime_number(unsigned long 9 10 /** 11 * for_each_prime_number - iterate over each p 12 * @prime: the current prime number in this it 13 * @max: the upper limit 14 * 15 * Starting from the first prime number 2 iter 16 * the @max value. On each iteration, @prime i 17 * @max should be less than ULONG_MAX to ensur 18 * @prime set to 1 on the first iteration use 19 * instead. 20 */ 21 #define for_each_prime_number(prime, max) \ 22 for_each_prime_number_from((prime), 2, 23 24 /** 25 * for_each_prime_number_from - iterate over e 26 * @prime: the current prime number in this it 27 * @from: the initial value 28 * @max: the upper limit 29 * 30 * Starting from @from iterate over each succe 31 * @max value. On each iteration, @prime is se 32 * @max should be less than ULONG_MAX, and @fr 33 * termination. 34 */ 35 #define for_each_prime_number_from(prime, from 36 for (prime = (from); prime <= (max); p 37 38 #endif /* !__LINUX_PRIME_NUMBERS_H */ 39
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.