File tree Expand file tree Collapse file tree 4 files changed +29
-52
lines changed Expand file tree Collapse file tree 4 files changed +29
-52
lines changed Original file line number Diff line number Diff line change 9
9
$defs << "-DJSON_DEBUG" if ENV [ "JSON_DEBUG" ]
10
10
11
11
if enable_config ( 'generator-use-simd' , default = !ENV [ "JSON_DISABLE_SIMD" ] )
12
- if RbConfig ::CONFIG [ 'host_cpu' ] =~ /^(arm.*|aarch64.*)/
13
- # Try to compile a small program using NEON instructions
14
- if have_header ( 'arm_neon.h' )
15
- have_type ( 'uint8x16_t' , headers = [ 'arm_neon.h' ] ) && try_compile ( <<~'SRC' )
16
- #include <arm_neon.h>
17
- int main() {
18
- uint8x16_t test = vdupq_n_u8(32);
19
- return 0;
20
- }
21
- SRC
22
- $defs. push ( "-DJSON_ENABLE_SIMD" )
23
- end
24
- end
25
-
26
- if have_header ( 'x86intrin.h' ) && have_type ( '__m128i' , headers = [ 'x86intrin.h' ] ) && try_compile ( <<~'SRC' )
27
- #include <x86intrin.h>
28
- int main() {
29
- __m128i test = _mm_set1_epi8(32);
30
- return 0;
31
- }
32
- SRC
33
- $defs. push ( "-DJSON_ENABLE_SIMD" )
34
- end
35
-
36
- have_header ( 'cpuid.h' )
12
+ require_relative "../simd/conf.rb"
37
13
end
38
14
39
15
create_makefile 'json/ext/generator'
Original file line number Diff line number Diff line change 9
9
append_cflags ( "-std=c99" )
10
10
11
11
if enable_config ( 'parser-use-simd' , default = !ENV [ "JSON_DISABLE_SIMD" ] )
12
- if RbConfig ::CONFIG [ 'host_cpu' ] =~ /^(arm.*|aarch64.*)/
13
- # Try to compile a small program using NEON instructions
14
- if have_header ( 'arm_neon.h' )
15
- have_type ( 'uint8x16_t' , headers = [ 'arm_neon.h' ] ) && try_compile ( <<~'SRC' )
16
- #include <arm_neon.h>
17
- int main() {
18
- uint8x16_t test = vdupq_n_u8(32);
19
- return 0;
20
- }
21
- SRC
22
- $defs. push ( "-DJSON_ENABLE_SIMD" )
23
- end
24
- end
25
-
26
- if have_header ( 'x86intrin.h' ) && have_type ( '__m128i' , headers = [ 'x86intrin.h' ] ) && try_compile ( <<~'SRC' )
27
- #include <x86intrin.h>
28
- int main() {
29
- __m128i test = _mm_set1_epi8(32);
30
- return 0;
31
- }
32
- SRC
33
- $defs. push ( "-DJSON_ENABLE_SIMD" )
34
- end
35
-
36
- have_header ( 'cpuid.h' )
37
- end
12
+ require_relative "../simd/conf.rb"
13
+ end
38
14
39
15
create_makefile 'json/ext/parser'
Original file line number Diff line number Diff line change
1
+ if RbConfig ::CONFIG [ 'host_cpu' ] =~ /^(arm.*|aarch64.*)/
2
+ # Try to compile a small program using NEON instructions
3
+ if have_header ( 'arm_neon.h' )
4
+ have_type ( 'uint8x16_t' , headers = [ 'arm_neon.h' ] ) && try_compile ( <<~'SRC' )
5
+ #include <arm_neon.h>
6
+ int main() {
7
+ uint8x16_t test = vdupq_n_u8(32);
8
+ return 0;
9
+ }
10
+ SRC
11
+ $defs. push ( "-DJSON_ENABLE_SIMD" )
12
+ end
13
+ end
14
+
15
+ if have_header ( 'x86intrin.h' ) && have_type ( '__m128i' , headers = [ 'x86intrin.h' ] ) && try_compile ( <<~'SRC' )
16
+ #include <x86intrin.h>
17
+ int main() {
18
+ __m128i test = _mm_set1_epi8(32);
19
+ return 0;
20
+ }
21
+ SRC
22
+ $defs. push ( "-DJSON_ENABLE_SIMD" )
23
+ end
24
+
25
+ have_header ( 'cpuid.h' )
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ spec = Gem::Specification.new do |s|
52
52
s . files += Dir [ "lib/json/ext/**/*.jar" ]
53
53
else
54
54
s . extensions = Dir [ "ext/json/**/extconf.rb" ]
55
- s . files += Dir [ "ext/json/**/*.{c,h}" ]
55
+ s . files += Dir [ "ext/json/**/*.{c,h,rb }" ]
56
56
end
57
57
end
58
58
You can’t perform that action at this time.
0 commit comments