Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid C4127 instead of suppressing #7

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions stl/inc/__msvc_string_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,18 +715,13 @@ constexpr size_t _Traits_find_first_of(_In_reads_(_Hay_size) const _Traits_ptr_t
if (!_STD _Is_constant_evaluated()) {
using _Elem = typename _Traits::char_type;

bool _Use_bitmap = true;

#if _USE_STD_VECTOR_ALGORITHMS
const bool _Try_vectorize = _Hay_size - _Start_at > _Threshold_find_first_of;

#pragma warning(push)
#pragma warning(disable : 4127) // conditional expression is constant
// Additional condition for when the vectorization outperforms the table lookup
if (_Try_vectorize && (sizeof(_Elem) == 1 || sizeof(_Elem) * _Needle_size <= 16)) {
_Use_bitmap = false;
}
#pragma warning(pop)
const bool _Use_bitmap = !_Try_vectorize || (sizeof(_Elem) > 1 && sizeof(_Elem) * _Needle_size > 16);
#else
const bool _Use_bitmap = true;
CaseyCarter marked this conversation as resolved.
Show resolved Hide resolved
#endif // _USE_STD_VECTOR_ALGORITHMS

if (_Use_bitmap) {
Expand Down