Skip to content

Commit

Permalink
vector_algorithms.cpp: clearer control flow in bitset::to_string (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGuteniev authored Mar 21, 2024
1 parent 9d761bd commit 15bccea
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions stl/src/vector_algorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2254,10 +2254,7 @@ __declspec(noalias) void __stdcall __std_bitset_to_string_1(
}

_mm256_zeroupper(); // TRANSITION, DevCom-10331414
return;
}

if (_Use_sse2()) {
} else if (_Use_sse2()) {
const __m128i _Px0 = _mm_set1_epi8(_Elem0 ^ _Elem1);
const __m128i _Px1 = _mm_set1_epi8(_Elem1);
if (_Size_bits >= 16) {
Expand Down Expand Up @@ -2290,13 +2287,13 @@ __declspec(noalias) void __stdcall __std_bitset_to_string_1(
_Dest[_Ix] = _Tmpd[_Ix];
}
}

return;
}
} else
#endif // !defined(_M_ARM64EC)
const auto _Arr = reinterpret_cast<const uint8_t*>(_Src);
for (size_t _Ix = 0; _Ix < _Size_bits; ++_Ix) {
_Dest[_Size_bits - 1 - _Ix] = ((_Arr[_Ix >> 3] >> (_Ix & 7)) & 1) != 0 ? _Elem1 : _Elem0;
{
const auto _Arr = reinterpret_cast<const uint8_t*>(_Src);
for (size_t _Ix = 0; _Ix < _Size_bits; ++_Ix) {
_Dest[_Size_bits - 1 - _Ix] = ((_Arr[_Ix >> 3] >> (_Ix & 7)) & 1) != 0 ? _Elem1 : _Elem0;
}
}
}

Expand Down Expand Up @@ -2337,10 +2334,7 @@ __declspec(noalias) void __stdcall __std_bitset_to_string_2(
}

_mm256_zeroupper(); // TRANSITION, DevCom-10331414
return;
}

if (_Use_sse2()) {
} else if (_Use_sse2()) {
const __m128i _Px0 = _mm_set1_epi16(_Elem0 ^ _Elem1);
const __m128i _Px1 = _mm_set1_epi16(_Elem1);
if (_Size_bits >= 8) {
Expand All @@ -2367,13 +2361,13 @@ __declspec(noalias) void __stdcall __std_bitset_to_string_2(
_Dest[_Ix] = _Tmpd[_Ix];
}
}

return;
}
} else
#endif // !defined(_M_ARM64EC)
const auto _Arr = reinterpret_cast<const uint8_t*>(_Src);
for (size_t _Ix = 0; _Ix < _Size_bits; ++_Ix) {
_Dest[_Size_bits - 1 - _Ix] = ((_Arr[_Ix >> 3] >> (_Ix & 7)) & 1) != 0 ? _Elem1 : _Elem0;
{
const auto _Arr = reinterpret_cast<const uint8_t*>(_Src);
for (size_t _Ix = 0; _Ix < _Size_bits; ++_Ix) {
_Dest[_Size_bits - 1 - _Ix] = ((_Arr[_Ix >> 3] >> (_Ix & 7)) & 1) != 0 ? _Elem1 : _Elem0;
}
}
}

Expand Down

0 comments on commit 15bccea

Please sign in to comment.