Skip to content

Commit d89dae9

Browse files
committed
Make variable constant expression
1 parent b67df3d commit d89dae9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libcxx/include/bitset

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const {
382382
unsigned long long __r = __first_[0];
383383
_LIBCPP_DIAGNOSTIC_PUSH
384384
_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshift-count-overflow")
385-
size_t __n_words = std::min<size_t>(_N_words, sizeof(unsigned long long) / sizeof(__storage_type));
385+
const size_t __ull_words = sizeof(unsigned long long) / sizeof(__storage_type);
386+
const size_t __n_words = _N_words < __ull_words ? _N_words : __ull_words;
386387
for (size_t __i = 1; __i < __n_words; ++__i)
387388
__r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT * __i);
388389
_LIBCPP_DIAGNOSTIC_POP

0 commit comments

Comments
 (0)