summaryrefslogtreecommitdiffstats
path: root/libcxx/include/__bit_reference
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-08-07 20:42:16 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-08-07 20:42:16 +0000
commit303e27d8ce2a51a38e3924537058a9416893720a (patch)
treee3ce167b14da073dcc534c766922284e8abf5516 /libcxx/include/__bit_reference
parent11da004ac16138b3ff7a980d1780dadeceb15da4 (diff)
downloadbcm5719-llvm-303e27d8ce2a51a38e3924537058a9416893720a.tar.gz
bcm5719-llvm-303e27d8ce2a51a38e3924537058a9416893720a.zip
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_reference4
1 files changed, 4 insertions, 0 deletions
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 8ff3bf6d9ee..58d475e4368 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_;
}
OpenPOWER on IntegriCloud