Skip to content

Commit 27c546a

Browse files
committed
Make tables all static const instead of constexpr
1 parent be44110 commit 27c546a

File tree

1 file changed

+6
-18
lines changed
  • include/boost/math/special_functions

1 file changed

+6
-18
lines changed

include/boost/math/special_functions/prime.hpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace boost{ namespace math{
1717

1818
template <class Policy>
19-
BOOST_MATH_CONSTEXPR_TABLE_FUNCTION std::uint32_t prime(unsigned n, const Policy& pol)
19+
inline std::uint32_t prime(unsigned n, const Policy& pol)
2020
{
2121
//
2222
// This is basically three big tables which together
@@ -26,29 +26,20 @@ namespace boost{ namespace math{
2626
// That gives us the first 10000 primes with the largest
2727
// being 104729:
2828
//
29-
#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
29+
3030
constexpr unsigned b1 = 53;
3131
constexpr unsigned b2 = 6541;
3232
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;
3833
static const std::array<unsigned char, 54> a1 = {{
39-
#endif
4034
2u, 3u, 5u, 7u, 11u, 13u, 17u, 19u, 23u, 29u, 31u,
4135
37u, 41u, 43u, 47u, 53u, 59u, 61u, 67u, 71u, 73u,
4236
79u, 83u, 89u, 97u, 101u, 103u, 107u, 109u, 113u,
4337
127u, 131u, 137u, 139u, 149u, 151u, 157u, 163u,
4438
167u, 173u, 179u, 181u, 191u, 193u, 197u, 199u,
4539
211u, 223u, 227u, 229u, 233u, 239u, 241u, 251u
4640
}};
47-
#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
48-
constexpr std::array<std::uint16_t, 6488> a2 = {{
49-
#else
41+
5042
static const std::array<std::uint16_t, 6488> a2 = {{
51-
#endif
5243
257u, 263u, 269u, 271u, 277u, 281u, 283u, 293u,
5344
307u, 311u, 313u, 317u, 331u, 337u, 347u, 349u, 353u,
5445
359u, 367u, 373u, 379u, 383u, 389u, 397u, 401u, 409u,
@@ -771,11 +762,8 @@ namespace boost{ namespace math{
771762
65323u, 65327u, 65353u, 65357u, 65371u, 65381u, 65393u, 65407u, 65413u,
772763
65419u, 65423u, 65437u, 65447u, 65449u, 65479u, 65497u, 65519u, 65521u
773764
}};
774-
#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
775-
constexpr std::array<std::uint16_t, 3458> a3 = {{
776-
#else
765+
777766
static const std::array<std::uint16_t, 3458> a3 = {{
778-
#endif
779767
2u, 4u, 8u, 16u, 22u, 28u, 44u,
780768
46u, 52u, 64u, 74u, 82u, 94u, 98u, 112u,
781769
116u, 122u, 142u, 152u, 164u, 166u, 172u, 178u,
@@ -1223,12 +1211,12 @@ namespace boost{ namespace math{
12231211
return static_cast<std::uint32_t>(a3[n - b2 - 1]) + 0xFFFFu;
12241212
}
12251213

1226-
inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION std::uint32_t prime(unsigned n)
1214+
inline std::uint32_t prime(unsigned n)
12271215
{
12281216
return boost::math::prime(n, boost::math::policies::policy<>());
12291217
}
12301218

1231-
static const unsigned max_prime = 9999;
1219+
constexpr unsigned max_prime = 9999;
12321220

12331221
}} // namespace boost and math
12341222

0 commit comments

Comments
 (0)