1010
1111#include < boost/math/policies/error_handling.hpp>
1212#include < boost/math/special_functions/math_fwd.hpp>
13- #include < array>
1413#include < cstdint>
1514
1615namespace boost { namespace math {
1716
1817 template <class Policy >
19- BOOST_MATH_CONSTEXPR_TABLE_FUNCTION std::uint32_t prime (unsigned n, const Policy& pol)
18+ inline std::uint32_t prime (unsigned n, const Policy& pol)
2019 {
2120 //
2221 // This is basically three big tables which together
@@ -26,29 +25,20 @@ namespace boost{ namespace math{
2625 // That gives us the first 10000 primes with the largest
2726 // being 104729:
2827 //
29- #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
3028 constexpr unsigned b1 = 53 ;
3129 constexpr unsigned b2 = 6541 ;
3230 constexpr unsigned b3 = 10000 ;
33- constexpr std::array<unsigned char , 54 > a1 = {{
34- #else
35- static const unsigned b1 = 53 ;
36- static const unsigned b2 = 6541 ;
37- static const unsigned b3 = 10000 ;
38- static const std::array<unsigned char , 54 > a1 = {{
39- #endif
31+
32+ static const unsigned char a1[] = {
4033 2u , 3u , 5u , 7u , 11u , 13u , 17u , 19u , 23u , 29u , 31u ,
4134 37u , 41u , 43u , 47u , 53u , 59u , 61u , 67u , 71u , 73u ,
4235 79u , 83u , 89u , 97u , 101u , 103u , 107u , 109u , 113u ,
4336 127u , 131u , 137u , 139u , 149u , 151u , 157u , 163u ,
4437 167u , 173u , 179u , 181u , 191u , 193u , 197u , 199u ,
4538 211u , 223u , 227u , 229u , 233u , 239u , 241u , 251u
46- }};
47- #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
48- constexpr std::array<std::uint16_t , 6488 > a2 = {{
49- #else
50- static const std::array<std::uint16_t , 6488 > a2 = {{
51- #endif
39+ };
40+
41+ static const std::uint16_t a2[] = {
5242 257u , 263u , 269u , 271u , 277u , 281u , 283u , 293u ,
5343 307u , 311u , 313u , 317u , 331u , 337u , 347u , 349u , 353u ,
5444 359u , 367u , 373u , 379u , 383u , 389u , 397u , 401u , 409u ,
@@ -770,12 +760,9 @@ namespace boost{ namespace math{
770760 65203u , 65213u , 65239u , 65257u , 65267u , 65269u , 65287u , 65293u , 65309u ,
771761 65323u , 65327u , 65353u , 65357u , 65371u , 65381u , 65393u , 65407u , 65413u ,
772762 65419u , 65423u , 65437u , 65447u , 65449u , 65479u , 65497u , 65519u , 65521u
773- }};
774- #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
775- constexpr std::array<std::uint16_t , 3458 > a3 = {{
776- #else
777- static const std::array<std::uint16_t , 3458 > a3 = {{
778- #endif
763+ };
764+
765+ static const std::uint16_t a3[] = {
779766 2u , 4u , 8u , 16u , 22u , 28u , 44u ,
780767 46u , 52u , 64u , 74u , 82u , 94u , 98u , 112u ,
781768 116u , 122u , 142u , 152u , 164u , 166u , 172u , 178u ,
@@ -1209,7 +1196,7 @@ namespace boost{ namespace math{
12091196 39016u , 39026u , 39044u , 39058u , 39062u , 39088u , 39104u , 39116u ,
12101197 39124u , 39142u , 39146u , 39148u , 39158u , 39166u , 39172u , 39176u ,
12111198 39182u , 39188u , 39194u
1212- }} ;
1199+ };
12131200
12141201 if (n <= b1)
12151202 return a1[n];
@@ -1223,12 +1210,12 @@ namespace boost{ namespace math{
12231210 return static_cast <std::uint32_t >(a3[n - b2 - 1 ]) + 0xFFFFu ;
12241211 }
12251212
1226- inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION std::uint32_t prime (unsigned n)
1213+ inline std::uint32_t prime (unsigned n)
12271214 {
12281215 return boost::math::prime (n, boost::math::policies::policy<>());
12291216 }
12301217
1231- static const unsigned max_prime = 9999 ;
1218+ constexpr unsigned max_prime = 9999 ;
12321219
12331220}} // namespace boost and math
12341221
0 commit comments