Skip to content

Commit b3258ed

Browse files
committed
fix MSVC warning when compiling for 32bit target
1 parent 7cd50a7 commit b3258ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/hurchalla/factoring/detail/ImplFactorByTable32.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <fstream>
1717
#include <exception>
1818
#include <type_traits>
19+
#include <limits>
1920

2021
namespace hurchalla { namespace detail {
2122

@@ -228,10 +229,12 @@ class ImplFactorByTable32
228229
for (std::size_t j=1; j<size_wheel_divs; ++j) {
229230
std::uint64_t wd = wheel_divs[j];
230231
std::uint64_t two_wd = wd + wd;
231-
odd_coprime_sieve[wd/2] = 0;
232+
odd_coprime_sieve[static_cast<std::size_t>(wd/2)] = 0;
232233
for (std::uint64_t i=wd*wd; i<wheel_size; i+=two_wd) {
233234
HPBC_CONSTEXPR_ASSERT(i/2 < half_wheel_size);
234-
odd_coprime_sieve[i/2] = 0;
235+
static_assert((wheel_size-1)/2 <=
236+
std::numeric_limits<std::size_t>::max());
237+
odd_coprime_sieve[static_cast<std::size_t>(i/2)] = 0;
235238
}
236239
}
237240

0 commit comments

Comments
 (0)