Skip to content

Commit ee9eb32

Browse files
committed
use zend_simd.h in string.c
1 parent b471a90 commit ee9eb32

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/standard/string.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@
4646
#include "ext/random/php_random.h"
4747

4848
#ifdef __SSE2__
49-
#include <emmintrin.h>
5049
#include "Zend/zend_bitset.h"
5150
#endif
5251

52+
#include "zend_simd.h"
53+
5354
/* this is read-only, so it's ok */
5455
ZEND_SET_ALIGNED(16, static const char hexconvtab[]) = "0123456789abcdef";
5556

@@ -2817,7 +2818,7 @@ static zend_string *php_strtr_ex(zend_string *str, const char *str_from, const c
28172818
char *input = ZSTR_VAL(str);
28182819
size_t len = ZSTR_LEN(str);
28192820

2820-
#ifdef __SSE2__
2821+
#ifdef ZEND_HAVE_VECTOR_128
28212822
if (ZSTR_LEN(str) >= sizeof(__m128i)) {
28222823
__m128i search = _mm_set1_epi8(ch_from);
28232824
__m128i delta = _mm_set1_epi8(ch_to - ch_from);
@@ -3037,7 +3038,7 @@ static zend_always_inline zend_long count_chars(const char *p, zend_long length,
30373038
zend_long count = 0;
30383039
const char *endp;
30393040

3040-
#ifdef __SSE2__
3041+
#ifdef ZEND_HAVE_VECTOR_128
30413042
if (length >= sizeof(__m128i)) {
30423043
__m128i search = _mm_set1_epi8(ch);
30433044

@@ -5835,7 +5836,7 @@ static zend_string *php_str_rot13(zend_string *str)
58355836
e = p + ZSTR_LEN(str);
58365837
target = ZSTR_VAL(ret);
58375838

5838-
#ifdef __SSE2__
5839+
#ifdef ZEND_HAVE_VECTOR_128
58395840
if (e - p > 15) {
58405841
const __m128i a_minus_1 = _mm_set1_epi8('a' - 1);
58415842
const __m128i m_plus_1 = _mm_set1_epi8('m' + 1);

0 commit comments

Comments
 (0)