Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5453927

Browse files
committed
fix
1 parentb3a52df commit5453927

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎stl/src/vector_algorithms.cpp‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3991,16 +3991,20 @@ namespace {
39913991

39923992
constsize_t _Byte_size = _Needle_length *sizeof(_Ty);
39933993

3994+
constexprsize_t _Vec_size =sizeof(_Mask);
3995+
constexprsize_t _Vec_mask = _Vec_size -1;
3996+
static_assert((_Vec_size & _Vec_mask) ==0);
3997+
39943998
constvoid* _Stop = _Needle_ptr;
3995-
_Advance_bytes(_Stop, _Byte_size & ~size_t{0x1F});
3996-
for (; _Needle_ptr != _Stop; _Needle_ptr +=32 /sizeof(_Ty)) {
3999+
_Advance_bytes(_Stop, _Byte_size & ~_Vec_mask);
4000+
for (; _Needle_ptr != _Stop; _Needle_ptr +=_Vec_size /sizeof(_Ty)) {
39974001
const __m128i _Data =_mm_loadu_si128(reinterpret_cast<const __m128i*>(_Needle_ptr));
39984002
if (!_mm_testz_si128(_Mask, _Data)) {
39994003
returnfalse;
40004004
}
40014005
}
40024006

4003-
_Advance_bytes(_Stop, _Byte_size &0x1E);
4007+
_Advance_bytes(_Stop, _Byte_size &_Vec_mask);
40044008
for (; _Needle_ptr != _Stop; ++_Needle_ptr) {
40054009
if ((*_Needle_ptr & ~_Ty{0xFF}) !=0) {
40064010
returnfalse;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp