functions.h (__check_partition_lower_aux): Remove redundant comparison with pivot value.

2012-08-03  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/functions.h (__check_partition_lower_aux): Remove
	redundant comparison with pivot value.
	(__check_partition_upper_aux): Likewise.

From-SVN: r190134
This commit is contained in:
François Dumont 2012-08-03 19:34:49 +00:00
parent a6de48da4d
commit 4d02a6956b
2 changed files with 62 additions and 24 deletions

View File

@ -1,3 +1,9 @@
2012-08-03 François Dumont <fdumont@gcc.gnu.org>
* include/debug/functions.h (__check_partition_lower_aux): Remove
redundant comparison with pivot value.
(__check_partition_upper_aux): Likewise.
2012-08-03 Ollie Wild <aaw@google.com> 2012-08-03 Ollie Wild <aaw@google.com>
Richard Smith <richardsmith@google.com> Richard Smith <richardsmith@google.com>

View File

@ -354,8 +354,12 @@ namespace __gnu_debug
{ {
while (__first != __last && *__first < __value) while (__first != __last && *__first < __value)
++__first; ++__first;
while (__first != __last && !(*__first < __value)) if (__first != __last)
++__first; {
++__first;
while (__first != __last && !(*__first < __value))
++__first;
}
return __first == __last; return __first == __last;
} }
@ -368,8 +372,10 @@ namespace __gnu_debug
const _Safe_iterator<_Iterator, _Sequence>& __last, const _Safe_iterator<_Iterator, _Sequence>& __last,
const _Tp& __value, const _Tp& __value,
std::random_access_iterator_tag __tag) std::random_access_iterator_tag __tag)
{ return __check_partitioned_lower_aux(__first.base(), __last.base(), {
__value, __tag); } return __check_partitioned_lower_aux(__first.base(), __last.base(),
__value, __tag);
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 270. Binary search requirements overly strict // 270. Binary search requirements overly strict
@ -378,8 +384,10 @@ namespace __gnu_debug
inline bool inline bool
__check_partitioned_lower(_ForwardIterator __first, __check_partitioned_lower(_ForwardIterator __first,
_ForwardIterator __last, const _Tp& __value) _ForwardIterator __last, const _Tp& __value)
{ return __check_partitioned_lower_aux(__first, __last, __value, {
std::__iterator_category(__first)); } return __check_partitioned_lower_aux(__first, __last, __value,
std::__iterator_category(__first));
}
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
inline bool inline bool
@ -389,8 +397,12 @@ namespace __gnu_debug
{ {
while (__first != __last && !(__value < *__first)) while (__first != __last && !(__value < *__first))
++__first; ++__first;
while (__first != __last && __value < *__first) if (__first != __last)
++__first; {
++__first;
while (__first != __last && __value < *__first)
++__first;
}
return __first == __last; return __first == __last;
} }
@ -403,15 +415,19 @@ namespace __gnu_debug
const _Safe_iterator<_Iterator, _Sequence>& __last, const _Safe_iterator<_Iterator, _Sequence>& __last,
const _Tp& __value, const _Tp& __value,
std::random_access_iterator_tag __tag) std::random_access_iterator_tag __tag)
{ return __check_partitioned_upper_aux(__first.base(), __last.base(), {
__value, __tag); } return __check_partitioned_upper_aux(__first.base(), __last.base(),
__value, __tag);
}
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
inline bool inline bool
__check_partitioned_upper(_ForwardIterator __first, __check_partitioned_upper(_ForwardIterator __first,
_ForwardIterator __last, const _Tp& __value) _ForwardIterator __last, const _Tp& __value)
{ return __check_partitioned_upper_aux(__first, __last, __value, {
std::__iterator_category(__first)); } return __check_partitioned_upper_aux(__first, __last, __value,
std::__iterator_category(__first));
}
template<typename _ForwardIterator, typename _Tp, typename _Pred> template<typename _ForwardIterator, typename _Tp, typename _Pred>
inline bool inline bool
@ -422,8 +438,12 @@ namespace __gnu_debug
{ {
while (__first != __last && bool(__pred(*__first, __value))) while (__first != __last && bool(__pred(*__first, __value)))
++__first; ++__first;
while (__first != __last && !bool(__pred(*__first, __value))) if (__first != __last)
++__first; {
++__first;
while (__first != __last && !bool(__pred(*__first, __value)))
++__first;
}
return __first == __last; return __first == __last;
} }
@ -437,8 +457,10 @@ namespace __gnu_debug
const _Safe_iterator<_Iterator, _Sequence>& __last, const _Safe_iterator<_Iterator, _Sequence>& __last,
const _Tp& __value, _Pred __pred, const _Tp& __value, _Pred __pred,
std::random_access_iterator_tag __tag) std::random_access_iterator_tag __tag)
{ return __check_partitioned_lower_aux(__first.base(), __last.base(), {
__value, __pred, __tag); } return __check_partitioned_lower_aux(__first.base(), __last.base(),
__value, __pred, __tag);
}
// Determine if a sequence is partitioned w.r.t. this element. // Determine if a sequence is partitioned w.r.t. this element.
template<typename _ForwardIterator, typename _Tp, typename _Pred> template<typename _ForwardIterator, typename _Tp, typename _Pred>
@ -446,8 +468,10 @@ namespace __gnu_debug
__check_partitioned_lower(_ForwardIterator __first, __check_partitioned_lower(_ForwardIterator __first,
_ForwardIterator __last, const _Tp& __value, _ForwardIterator __last, const _Tp& __value,
_Pred __pred) _Pred __pred)
{ return __check_partitioned_lower_aux(__first, __last, __value, __pred, {
std::__iterator_category(__first)); } return __check_partitioned_lower_aux(__first, __last, __value, __pred,
std::__iterator_category(__first));
}
template<typename _ForwardIterator, typename _Tp, typename _Pred> template<typename _ForwardIterator, typename _Tp, typename _Pred>
inline bool inline bool
@ -458,8 +482,12 @@ namespace __gnu_debug
{ {
while (__first != __last && !bool(__pred(__value, *__first))) while (__first != __last && !bool(__pred(__value, *__first)))
++__first; ++__first;
while (__first != __last && bool(__pred(__value, *__first))) if (__first != __last)
++__first; {
++__first;
while (__first != __last && bool(__pred(__value, *__first)))
++__first;
}
return __first == __last; return __first == __last;
} }
@ -473,16 +501,20 @@ namespace __gnu_debug
const _Safe_iterator<_Iterator, _Sequence>& __last, const _Safe_iterator<_Iterator, _Sequence>& __last,
const _Tp& __value, _Pred __pred, const _Tp& __value, _Pred __pred,
std::random_access_iterator_tag __tag) std::random_access_iterator_tag __tag)
{ return __check_partitioned_upper_aux(__first.base(), __last.base(), {
__value, __pred, __tag); } return __check_partitioned_upper_aux(__first.base(), __last.base(),
__value, __pred, __tag);
}
template<typename _ForwardIterator, typename _Tp, typename _Pred> template<typename _ForwardIterator, typename _Tp, typename _Pred>
inline bool inline bool
__check_partitioned_upper(_ForwardIterator __first, __check_partitioned_upper(_ForwardIterator __first,
_ForwardIterator __last, const _Tp& __value, _ForwardIterator __last, const _Tp& __value,
_Pred __pred) _Pred __pred)
{ return __check_partitioned_upper_aux(__first, __last, __value, __pred, {
std::__iterator_category(__first)); } return __check_partitioned_upper_aux(__first, __last, __value, __pred,
std::__iterator_category(__first));
}
// Helper struct to detect random access safe iterators. // Helper struct to detect random access safe iterators.
template<typename _Iterator> template<typename _Iterator>