@@ -253,26 +253,16 @@ inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT
253253
254254template <size_t _N_words, size_t _Size>
255255void __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT {
256- __storage_type __t [sizeof (unsigned long long ) / sizeof (__storage_type)];
257- size_t __sz = _Size;
258- for (size_t __i = 0 ; __i < sizeof (__t ) / sizeof (__t [0 ]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word)
259- if (__sz < __bits_per_word)
260- __t [__i] = static_cast <__storage_type>(__v) & (1ULL << __sz) - 1 ;
261- else
262- __t [__i] = static_cast <__storage_type>(__v);
263-
264- std::copy (__t , __t + sizeof (__t ) / sizeof (__t [0 ]), __first_);
265- std::fill (
266- __first_ + sizeof (__t ) / sizeof (__t [0 ]), __first_ + sizeof (__first_) / sizeof (__first_[0 ]), __storage_type (0 ));
256+ const size_t __ull_words = sizeof (unsigned long long ) / sizeof (__storage_type);
257+ for (size_t __i = 0 ; __i < __ull_words; ++__i, __v >>= __bits_per_word)
258+ __first_[__i] = static_cast <__storage_type>(__v);
259+ std::fill (__first_ + __ull_words, __first_ + _N_words, __storage_type (0 ));
267260}
268261
269262template <size_t _N_words, size_t _Size>
270263inline _LIBCPP_HIDE_FROM_ABI void __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT {
271264 __first_[0 ] = __v;
272- if (_Size < __bits_per_word)
273- __first_[0 ] &= (1ULL << _Size) - 1 ;
274-
275- std::fill (__first_ + 1 , __first_ + sizeof (__first_) / sizeof (__first_[0 ]), __storage_type (0 ));
265+ std::fill (__first_ + 1 , __first_ + _N_words, __storage_type (0 ));
276266}
277267
278268# endif // _LIBCPP_CXX03_LANG
0 commit comments