File tree Expand file tree Collapse file tree
include/boost/safe_numbers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -447,7 +447,7 @@ BOOST_SAFE_NUMBERS_DETAIL_INT128_HOST_DEVICE BOOST_SAFE_NUMBERS_DETAIL_INT128_FO
447447 return ;
448448 }
449449
450- #else
450+ #endif
451451
452452 if (rhs <= UINT32_MAX )
453453 {
@@ -467,8 +467,6 @@ BOOST_SAFE_NUMBERS_DETAIL_INT128_HOST_DEVICE BOOST_SAFE_NUMBERS_DETAIL_INT128_FO
467467 quotient = impl::from_words<T>(q);
468468 remainder = impl::from_words<T>(u);
469469 }
470-
471- #endif
472470}
473471
474472template <typename T>
Original file line number Diff line number Diff line change @@ -70,13 +70,14 @@ BOOST_SAFE_NUMBERS_EXPORT constexpr auto operator ""_u128(const char* str) -> u1
7070 int128::uint128_t result;
7171 const auto r {int128::detail::from_chars (str, str + int128::detail::strlen (str), result)};
7272
73- if (r == EDOM )
73+ switch (r)
7474 {
75- BOOST_SAFE_NUMBERS_THROW_EXCEPTION (std::overflow_error, " Overflow detected in literal construction" );
76- }
77- else if (r == EINVAL )
78- {
79- BOOST_SAFE_NUMBERS_THROW_EXCEPTION (std::invalid_argument, " Invalid conversion from literal" );
75+ case EDOM :
76+ BOOST_SAFE_NUMBERS_THROW_EXCEPTION (std::overflow_error, " Overflow detected in literal construction" );
77+ case EINVAL :
78+ BOOST_SAFE_NUMBERS_THROW_EXCEPTION (std::invalid_argument, " Invalid conversion from literal" );
79+ default :
80+ static_cast <void >(r);
8081 }
8182
8283 return u128 {result};
@@ -127,13 +128,14 @@ BOOST_SAFE_NUMBERS_EXPORT constexpr auto operator ""_i128(const char* str) -> i1
127128 int128::int128_t result;
128129 const auto r {int128::detail::from_chars (str, str + int128::detail::strlen (str), result)};
129130
130- if (r == EDOM )
131- {
132- BOOST_SAFE_NUMBERS_THROW_EXCEPTION (std::overflow_error, " Overflow detected in literal construction" );
133- }
134- else if (r == EINVAL )
131+ switch (r)
135132 {
136- BOOST_SAFE_NUMBERS_THROW_EXCEPTION (std::invalid_argument, " Invalid conversion from literal" );
133+ case EDOM :
134+ BOOST_SAFE_NUMBERS_THROW_EXCEPTION (std::overflow_error, " Overflow detected in literal construction" );
135+ case EINVAL :
136+ BOOST_SAFE_NUMBERS_THROW_EXCEPTION (std::invalid_argument, " Invalid conversion from literal" );
137+ default :
138+ static_cast <void >(r);
137139 }
138140
139141 return i128 {result};
You can’t perform that action at this time.
0 commit comments