]> granicus.if.org Git - php/commitdiff
Move map out of loop
authorXinchen Hui <laruence@gmail.com>
Sun, 18 Feb 2018 11:34:48 +0000 (19:34 +0800)
committerXinchen Hui <laruence@gmail.com>
Sun, 18 Feb 2018 11:34:48 +0000 (19:34 +0800)
ext/standard/string.c

index 2a79378c4be9d2162d57ed48543b468551dec2c3..fce878358a60cdd2dd4bf2936e0873efc9c3f624 100644 (file)
@@ -3531,17 +3531,19 @@ PHP_FUNCTION(strrev)
        e = s + ZSTR_LEN(str);
        --e;
 #if ZEND_INTRIN_SSSE3_NATIVE
-       while (e - s > 15) {
+       do {
                const __m128i map = _mm_set_epi8(
                                0, 1, 2, 3,
                                4, 5, 6, 7,
                                8, 9, 10, 11,
                                12, 13, 14, 15);
-               const __m128i str = _mm_loadu_si128((__m128i *)(e - 15));
-               _mm_storeu_si128((__m128i *)p, _mm_shuffle_epi8(str, map));
-               p += 16;
-               e -= 16;
-       }
+               while (e - s > 15) {
+                       const __m128i str = _mm_loadu_si128((__m128i *)(e - 15));
+                       _mm_storeu_si128((__m128i *)p, _mm_shuffle_epi8(str, map));
+                       p += 16;
+                       e -= 16;
+               }
+       } while(0);
 #endif
        while (e >= s) {
                *p++ = *e--;