From bc334be4db8b933974e5ff3fef45333aec93ec74 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Sun, 29 Jun 2025 12:04:34 +0200 Subject: [ruby/json] Reduce duplication in extconf.rb https://github.com/ruby/json/commit/3ae3eeb9d3 --- ext/json/parser/extconf.rb | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'ext/json/parser') diff --git a/ext/json/parser/extconf.rb b/ext/json/parser/extconf.rb index eca4d8c108..0b62fd6135 100644 --- a/ext/json/parser/extconf.rb +++ b/ext/json/parser/extconf.rb @@ -9,31 +9,7 @@ have_func("strnlen", "string.h") # Missing on Solaris 10 append_cflags("-std=c99") if enable_config('parser-use-simd', default=!ENV["JSON_DISABLE_SIMD"]) - if RbConfig::CONFIG['host_cpu'] =~ /^(arm.*|aarch64.*)/ - # Try to compile a small program using NEON instructions - if have_header('arm_neon.h') - have_type('uint8x16_t', headers=['arm_neon.h']) && try_compile(<<~'SRC') - #include - int main() { - uint8x16_t test = vdupq_n_u8(32); - return 0; - } - SRC - $defs.push("-DJSON_ENABLE_SIMD") - end - end - - if have_header('x86intrin.h') && have_type('__m128i', headers=['x86intrin.h']) && try_compile(<<~'SRC') - #include - int main() { - __m128i test = _mm_set1_epi8(32); - return 0; - } - SRC - $defs.push("-DJSON_ENABLE_SIMD") - end - - have_header('cpuid.h') - end + require_relative "../simd/conf.rb" +end create_makefile 'json/ext/parser' -- cgit v1.2.3