Skip to content

Commit 609393b

Browse files
committed
Namespace the ENABLE_SIMD define
1 parent 0bfe7cc commit 609393b

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

ext/json/ext/generator/extconf.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
return 0;
1919
}
2020
SRC
21-
$defs.push("-DENABLE_SIMD")
21+
$defs.push("-DJSON_ENABLE_SIMD")
2222
end
2323
end
2424

@@ -29,7 +29,7 @@
2929
return 0;
3030
}
3131
SRC
32-
$defs.push("-DENABLE_SIMD")
32+
$defs.push("-DJSON_ENABLE_SIMD")
3333
end
3434

3535
have_header('cpuid.h')

ext/json/ext/generator/generator.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ typedef struct _search_state {
112112
const char *cursor;
113113
FBuffer *buffer;
114114

115-
#ifdef ENABLE_SIMD
115+
#ifdef JSON_ENABLE_SIMD
116116
const char *chunk_base;
117117
const char *chunk_end;
118118
bool has_matches;
@@ -124,7 +124,7 @@ typedef struct _search_state {
124124
#else
125125
#error "Unknown SIMD Implementation."
126126
#endif /* HAVE_SIMD_NEON */
127-
#endif /* ENABLE_SIMD */
127+
#endif /* JSON_ENABLE_SIMD */
128128
} search_state;
129129

130130
#if (defined(__GNUC__ ) || defined(__clang__))
@@ -261,7 +261,7 @@ static inline void escape_UTF8_char(search_state *search, unsigned char ch_len)
261261
search->cursor = (search->ptr += ch_len);
262262
}
263263

264-
#ifdef ENABLE_SIMD
264+
#ifdef JSON_ENABLE_SIMD
265265

266266
static inline FORCE_INLINE char *copy_remaining_bytes(search_state *search, unsigned long vec_len, unsigned long len)
267267
{
@@ -533,7 +533,7 @@ static inline TARGET_SSE2 FORCE_INLINE unsigned char search_escape_basic_sse2(se
533533

534534
#endif /* HAVE_SIMD_SSE2 */
535535

536-
#endif /* ENABLE_SIMD */
536+
#endif /* JSON_ENABLE_SIMD */
537537

538538
static const unsigned char script_safe_escape_table[256] = {
539539
// ASCII Control Characters
@@ -1298,11 +1298,11 @@ static void generate_json_string(FBuffer *buffer, struct generate_json_data *dat
12981298
search.cursor = search.ptr;
12991299
search.end = search.ptr + len;
13001300

1301-
#ifdef ENABLE_SIMD
1301+
#ifdef JSON_ENABLE_SIMD
13021302
search.matches_mask = 0;
13031303
search.has_matches = false;
13041304
search.chunk_base = NULL;
1305-
#endif /* ENABLE_SIMD */
1305+
#endif /* JSON_ENABLE_SIMD */
13061306

13071307
switch(rb_enc_str_coderange(obj)) {
13081308
case ENC_CODERANGE_7BIT:
@@ -2170,7 +2170,7 @@ void Init_generator(void)
21702170

21712171

21722172
switch(find_simd_implementation()) {
2173-
#ifdef ENABLE_SIMD
2173+
#ifdef JSON_ENABLE_SIMD
21742174
#ifdef HAVE_SIMD_NEON
21752175
case SIMD_NEON:
21762176
search_escape_basic_impl = search_escape_basic_neon;
@@ -2181,7 +2181,7 @@ void Init_generator(void)
21812181
search_escape_basic_impl = search_escape_basic_sse2;
21822182
break;
21832183
#endif /* HAVE_SIMD_SSE2 */
2184-
#endif /* ENABLE_SIMD */
2184+
#endif /* JSON_ENABLE_SIMD */
21852185
default:
21862186
search_escape_basic_impl = search_escape_basic;
21872187
break;

ext/json/ext/generator/simd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ typedef enum {
44
SIMD_SSE2
55
} SIMD_Implementation;
66

7-
#ifdef ENABLE_SIMD
7+
#ifdef JSON_ENABLE_SIMD
88

99
#ifdef __clang__
1010
#if __has_builtin(__builtin_ctzll)
@@ -101,7 +101,7 @@ static SIMD_Implementation find_simd_implementation(void) {
101101
#endif /* HAVE_X86INTRIN_H */
102102
#endif /* X86_64 Support */
103103

104-
#endif /* ENABLE_SIMD */
104+
#endif /* JSON_ENABLE_SIMD */
105105

106106
#ifndef FIND_SIMD_IMPLEMENTATION_DEFINED
107107
static SIMD_Implementation find_simd_implementation(void) {

0 commit comments

Comments
 (0)