Skip to content

Commit b56f203

Browse files
committed
Move declaration at top of the block
1 parent ba45add commit b56f203

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

Zend/zend_operators.c

+17-15
Original file line numberDiff line numberDiff line change
@@ -2624,30 +2624,32 @@ ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, int
26242624
if (_mm_movemask_epi8(mingle)) {
26252625
zend_string *res = zend_string_alloc(length, persistent);
26262626
memcpy(ZSTR_VAL(res), ZSTR_VAL(str), p - (unsigned char *) ZSTR_VAL(str));
2627-
unsigned char *q = p + (ZSTR_VAL(res) - ZSTR_VAL(str));
2628-
2629-
/* Lowercase the chunk we already compared. */
2630-
const __m128i delta = _mm_set1_epi8('a' - 'A');
2631-
__m128i add = _mm_and_si128(mingle, delta);
2632-
__m128i lower = _mm_add_epi8(op, add);
2633-
_mm_storeu_si128((__m128i *) q, lower);
2634-
2635-
/* Lowercase the rest of the string. */
2636-
p += 16; q += 16;
2637-
zend_str_tolower_impl((char *) q, (const char *) p, end - p);
2638-
ZSTR_VAL(res)[length] = '\0';
2639-
return res;
2627+
do {
2628+
unsigned char *q = p + (ZSTR_VAL(res) - ZSTR_VAL(str));
2629+
2630+
/* Lowercase the chunk we already compared. */
2631+
const __m128i delta = _mm_set1_epi8('a' - 'A');
2632+
__m128i add = _mm_and_si128(mingle, delta);
2633+
__m128i lower = _mm_add_epi8(op, add);
2634+
_mm_storeu_si128((__m128i *) q, lower);
2635+
2636+
/* Lowercase the rest of the string. */
2637+
p += 16; q += 16;
2638+
zend_str_tolower_impl((char *) q, (const char *) p, end - p);
2639+
ZSTR_VAL(res)[length] = '\0';
2640+
return res;
2641+
} while (0);
26402642
}
26412643
p += 16;
26422644
}
26432645
#endif
26442646

26452647
while (p < end) {
26462648
if (*p != zend_tolower_ascii(*p)) {
2649+
unsigned char *q;
26472650
zend_string *res = zend_string_alloc(length, persistent);
26482651
memcpy(ZSTR_VAL(res), ZSTR_VAL(str), p - (unsigned char*) ZSTR_VAL(str));
2649-
2650-
unsigned char *q = p + (ZSTR_VAL(res) - ZSTR_VAL(str));
2652+
q = p + (ZSTR_VAL(res) - ZSTR_VAL(str));
26512653
while (p < end) {
26522654
*q++ = zend_tolower_ascii(*p++);
26532655
}

0 commit comments

Comments
 (0)