diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-08-08 00:42:16 +0400 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-08-08 00:42:16 +0400 |
commit | 303e27d8ce2a51a38e3924537058a9416893720a (patch) | |
tree | e3ce167b14da073dcc534c766922284e8abf5516 /libcxx/include/__bit_reference | |
parent | 11da004ac16138b3ff7a980d1780dadeceb15da4 (diff) |
Correct logic bug in find optimization for vector<bool>. This fixes http://llvm.org/bugs/show_bug.cgi?id=16816
llvm-svn: 187908
Diffstat (limited to 'libcxx/include/__bit_reference')
-rw-r--r-- | libcxx/include/__bit_reference | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference index 8ff3bf6d9ee7..58d475e4368a 100644 --- a/libcxx/include/__bit_reference +++ b/libcxx/include/__bit_reference @@ -173,6 +173,8 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __storage_type __b = *__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b))); + if (__n == __dn) + return _It(__first.__seg_, __first.__ctz_ + __n); __n -= __dn; ++__first.__seg_; } @@ -207,6 +209,8 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __storage_type __b = ~*__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b))); + if (__n == __dn) + return _It(__first.__seg_, __first.__ctz_ + __n); __n -= __dn; ++__first.__seg_; } |