Skip to content

Commit 1d7109d

Browse files
committed
abstract away
1 parent 81efe6b commit 1d7109d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ext/json/json_encoder.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
# include "zend_cpuinfo.h"
3939
#endif
4040

41+
#ifdef __SSE2__
42+
# define JSON_USE_SIMD
43+
#endif
44+
4145
static const char digits[] = "0123456789abcdef";
4246

4347
static zend_always_inline bool php_json_check_stack_limit(void)
@@ -448,7 +452,7 @@ static zend_always_inline bool php_json_printable_ascii_escape(smart_str *buf, u
448452
return true;
449453
}
450454

451-
#ifdef __SSE2__
455+
#ifdef JSON_USE_SIMD
452456
static zend_always_inline int php_json_sse2_compute_escape_intersection(const __m128i mask, const __m128i input)
453457
{
454458
(void) mask;
@@ -576,7 +580,7 @@ zend_result php_json_escape_string(
576580
0xffffffff, 0x500080c4, 0x10000000, 0x00000000,
577581
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff};
578582

579-
#ifdef __SSE2__
583+
#ifdef JSON_USE_SIMD
580584
while (len >= sizeof(__m128i)) {
581585
const __m128i input = _mm_loadu_si128((__m128i *) (s + pos));
582586
/* signed compare, so checks for unsigned bytes >= 0x80 as well */

0 commit comments

Comments
 (0)