10
10
11
11
#include < boost/math/policies/error_handling.hpp>
12
12
#include < boost/math/special_functions/math_fwd.hpp>
13
- #include < array>
14
13
#include < cstdint>
15
14
16
15
namespace boost { namespace math {
17
16
18
17
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)
20
19
{
21
20
//
22
21
// This is basically three big tables which together
@@ -26,29 +25,20 @@ namespace boost{ namespace math{
26
25
// That gives us the first 10000 primes with the largest
27
26
// being 104729:
28
27
//
29
- #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
30
28
constexpr unsigned b1 = 53 ;
31
29
constexpr unsigned b2 = 6541 ;
32
30
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[] = {
40
33
2u , 3u , 5u , 7u , 11u , 13u , 17u , 19u , 23u , 29u , 31u ,
41
34
37u , 41u , 43u , 47u , 53u , 59u , 61u , 67u , 71u , 73u ,
42
35
79u , 83u , 89u , 97u , 101u , 103u , 107u , 109u , 113u ,
43
36
127u , 131u , 137u , 139u , 149u , 151u , 157u , 163u ,
44
37
167u , 173u , 179u , 181u , 191u , 193u , 197u , 199u ,
45
38
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[] = {
52
42
257u , 263u , 269u , 271u , 277u , 281u , 283u , 293u ,
53
43
307u , 311u , 313u , 317u , 331u , 337u , 347u , 349u , 353u ,
54
44
359u , 367u , 373u , 379u , 383u , 389u , 397u , 401u , 409u ,
@@ -770,12 +760,9 @@ namespace boost{ namespace math{
770
760
65203u , 65213u , 65239u , 65257u , 65267u , 65269u , 65287u , 65293u , 65309u ,
771
761
65323u , 65327u , 65353u , 65357u , 65371u , 65381u , 65393u , 65407u , 65413u ,
772
762
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[] = {
779
766
2u , 4u , 8u , 16u , 22u , 28u , 44u ,
780
767
46u , 52u , 64u , 74u , 82u , 94u , 98u , 112u ,
781
768
116u , 122u , 142u , 152u , 164u , 166u , 172u , 178u ,
@@ -1209,7 +1196,7 @@ namespace boost{ namespace math{
1209
1196
39016u , 39026u , 39044u , 39058u , 39062u , 39088u , 39104u , 39116u ,
1210
1197
39124u , 39142u , 39146u , 39148u , 39158u , 39166u , 39172u , 39176u ,
1211
1198
39182u , 39188u , 39194u
1212
- }} ;
1199
+ };
1213
1200
1214
1201
if (n <= b1)
1215
1202
return a1[n];
@@ -1223,12 +1210,12 @@ namespace boost{ namespace math{
1223
1210
return static_cast <std::uint32_t >(a3[n - b2 - 1 ]) + 0xFFFFu ;
1224
1211
}
1225
1212
1226
- inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION std::uint32_t prime (unsigned n)
1213
+ inline std::uint32_t prime (unsigned n)
1227
1214
{
1228
1215
return boost::math::prime (n, boost::math::policies::policy<>());
1229
1216
}
1230
1217
1231
- static const unsigned max_prime = 9999 ;
1218
+ constexpr unsigned max_prime = 9999 ;
1232
1219
1233
1220
}} // namespace boost and math
1234
1221
0 commit comments