File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 99#include < __hash_table>
1010#include < algorithm>
1111#include < stdexcept>
12- #include < type_traits>
1312
1413_LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wtautological-constant-out-of-range-compare" )
1514
@@ -52,16 +51,15 @@ const unsigned indices[] = {
5251// are fewer potential primes to search, and fewer potential primes to divide
5352// against.
5453
55- template <size_t _Sz = sizeof (size_t )>
56- inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 4 , void >::type __check_for_overflow (size_t N) {
57- if (N > 0xFFFFFFFB )
58- std::__throw_overflow_error (" __next_prime overflow" );
59- }
60-
61- template <size_t _Sz = sizeof (size_t )>
62- inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 8 , void >::type __check_for_overflow (size_t N) {
63- if (N > 0xFFFFFFFFFFFFFFC5ull )
64- std::__throw_overflow_error (" __next_prime overflow" );
54+ inline void __check_for_overflow (size_t N) {
55+ if constexpr (sizeof (size_t ) == 4 ) {
56+ if (N > 0xFFFFFFFB )
57+ std::__throw_overflow_error (" __next_prime overflow" );
58+ } else {
59+ static_assert (sizeof (size_t ) == 8 );
60+ if (N > 0xFFFFFFFFFFFFFFC5ull )
61+ std::__throw_overflow_error (" __next_prime overflow" );
62+ }
6563}
6664
6765size_t __next_prime (size_t n) {
You can’t perform that action at this time.
0 commit comments