File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ members = ["cpu-features"]
55name = " json-escape-simd"
66version = " 3.0.0"
77edition = " 2024"
8- rust-version = " 1.89 .0"
8+ rust-version = " 1.85 .0"
99include = [" src/**/*.rs" ]
1010description = " Optimized SIMD routines for escaping JSON strings."
1111license = " MIT"
@@ -18,6 +18,7 @@ path = "examples/escape.rs"
1818
1919[features ]
2020codspeed = [" criterion2/codspeed" ]
21+ avx512 = []
2122asan = [] # for ASAN
2223
2324[[bench ]]
Original file line number Diff line number Diff line change @@ -297,9 +297,13 @@ fn format_string(value: &str, dst: &mut [u8]) -> usize {
297297
298298 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
299299 {
300- if is_x86_feature_detected ! ( "avx512f" ) {
301- unsafe { simd:: avx512:: format_string ( value, dst) }
302- } else if is_x86_feature_detected ! ( "avx2" ) {
300+ #[ cfg( feature = "avx512" ) ]
301+ {
302+ if is_x86_feature_detected ! ( "avx512f" ) {
303+ return unsafe { simd:: avx512:: format_string ( value, dst) } ;
304+ }
305+ }
306+ if is_x86_feature_detected ! ( "avx2" ) {
303307 unsafe { simd:: avx2:: format_string ( value, dst) }
304308 } else if is_x86_feature_detected ! ( "sse2" ) {
305309 unsafe { simd:: sse2:: format_string ( value, dst) }
Original file line number Diff line number Diff line change 22
33#[ cfg( any( target_arch = "x86_64" , target_arch = "x86" ) ) ]
44pub ( crate ) mod avx2;
5- #[ cfg( any( target_arch = "x86_64" , target_arch = "x86" ) ) ]
5+ #[ cfg( all ( any( target_arch = "x86_64" , target_arch = "x86" ) , feature = "avx512 ") ) ]
66pub ( crate ) mod avx512;
77pub mod bits;
88#[ cfg( target_arch = "aarch64" ) ]
You can’t perform that action at this time.
0 commit comments