~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/prime_numbers.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/prime_numbers.h (Version linux-6.12-rc7) and /include/linux/prime_numbers.h (Version linux-4.12.14)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php