0 | |
--- a/Cargo.toml
|
1 | |
+++ b/Cargo.toml
|
2 | |
@@ -31,9 +31,6 @@ version = "0.1.0"
|
3 | |
version = "1.0"
|
4 | |
optional = true
|
5 | |
|
6 | |
-[dependencies.simd]
|
7 | |
-version = "0.2.3"
|
8 | |
-optional = true
|
9 | |
[dev-dependencies.bincode]
|
10 | |
version = "0.8"
|
11 | |
|
12 | |
@@ -53,6 +50,6 @@ fast-legacy-encode = ["fast-hangul-encod
|
13 | |
less-slow-big5-hanzi-encode = []
|
14 | |
less-slow-gb-hanzi-encode = []
|
15 | |
less-slow-kanji-encode = []
|
16 | |
-simd-accel = ["simd"]
|
17 | |
+simd-accel = []
|
18 | |
[badges.travis-ci]
|
19 | |
repository = "hsivonen/encoding_rs"
|
20 | |
--- a/build.rs
|
21 | |
+++ b/build.rs
|
22 | |
@@ -1,4 +1,4 @@
|
23 | |
fn main() {
|
24 | |
- #[cfg(feature = "simd-accel")]
|
25 | |
+ #[cfg(feature = "simd-accel-disabled")]
|
26 | |
println!("cargo:rustc-env=RUSTC_BOOTSTRAP=1");
|
27 | |
}
|
28 | |
--- a/src/ascii.rs
|
29 | |
+++ b/src/ascii.rs
|
30 | |
@@ -22,7 +22,7 @@
|
31 | |
// different approaches based on benchmarking on Raspberry Pi 3.
|
32 | |
|
33 | |
#[cfg(all(
|
34 | |
- feature = "simd-accel",
|
35 | |
+ feature = "simd-accel-disabled",
|
36 | |
any(
|
37 | |
target_feature = "sse2",
|
38 | |
all(target_endian = "little", target_arch = "aarch64"),
|
39 | |
@@ -32,7 +32,7 @@
|
40 | |
use simd_funcs::*;
|
41 | |
|
42 | |
cfg_if! {
|
43 | |
- if #[cfg(feature = "simd-accel")] {
|
44 | |
+ if #[cfg(feature = "simd-accel-disabled")] {
|
45 | |
#[allow(unused_imports)]
|
46 | |
use ::std::intrinsics::unlikely;
|
47 | |
#[allow(unused_imports)]
|
48 | |
@@ -872,7 +872,7 @@ macro_rules! pack_simd_stride {
|
49 | |
}
|
50 | |
|
51 | |
cfg_if! {
|
52 | |
- if #[cfg(all(feature = "simd-accel", target_endian = "little", target_arch = "aarch64"))] {
|
53 | |
+ if #[cfg(all(feature = "simd-accel-disabled", target_endian = "little", target_arch = "aarch64"))] {
|
54 | |
// SIMD with the same instructions for aligned and unaligned loads and stores
|
55 | |
|
56 | |
pub const SIMD_STRIDE_SIZE: usize = 16;
|
57 | |
@@ -900,7 +900,7 @@ cfg_if! {
|
58 | |
ascii_simd_unalign!(basic_latin_to_ascii, u16, u8, basic_latin_to_ascii_stride_neither_aligned);
|
59 | |
latin1_simd_unalign!(unpack_latin1, u8, u16, unpack_stride_neither_aligned);
|
60 | |
latin1_simd_unalign!(pack_latin1, u16, u8, pack_stride_neither_aligned);
|
61 | |
- } else if #[cfg(all(feature = "simd-accel", target_endian = "little", target_feature = "neon"))] {
|
62 | |
+ } else if #[cfg(all(feature = "simd-accel-disabled", target_endian = "little", target_feature = "neon"))] {
|
63 | |
// SIMD with different instructions for aligned and unaligned loads and stores.
|
64 | |
//
|
65 | |
// Newer microarchitectures are not supposed to have a performance difference between
|
66 | |
@@ -943,7 +943,7 @@ cfg_if! {
|
67 | |
ascii_simd_check_align!(basic_latin_to_ascii, u16, u8, basic_latin_to_ascii_stride_both_aligned, basic_latin_to_ascii_stride_src_aligned, basic_latin_to_ascii_stride_dst_aligned, basic_latin_to_ascii_stride_neither_aligned);
|
68 | |
latin1_simd_check_align!(unpack_latin1, u8, u16, unpack_stride_both_aligned, unpack_stride_src_aligned, unpack_stride_dst_aligned, unpack_stride_neither_aligned);
|
69 | |
latin1_simd_check_align!(pack_latin1, u16, u8, pack_stride_both_aligned, pack_stride_src_aligned, pack_stride_dst_aligned, pack_stride_neither_aligned);
|
70 | |
- } else if #[cfg(all(feature = "simd-accel", target_feature = "sse2"))] {
|
71 | |
+ } else if #[cfg(all(feature = "simd-accel-disabled", target_feature = "sse2"))] {
|
72 | |
// SIMD with different instructions for aligned and unaligned loads and stores.
|
73 | |
//
|
74 | |
// Newer microarchitectures are not supposed to have a performance difference between
|
75 | |
@@ -1205,7 +1205,7 @@ cfg_if! {
|
76 | |
}
|
77 | |
|
78 | |
cfg_if! {
|
79 | |
- if #[cfg(all(feature = "simd-accel", target_endian = "little", target_arch = "disabled"))] {
|
80 | |
+ if #[cfg(all(feature = "simd-accel-disabled", target_endian = "little", target_arch = "disabled"))] {
|
81 | |
#[inline(always)]
|
82 | |
pub fn validate_ascii(slice: &[u8]) -> Option<(u8, usize)> {
|
83 | |
let src = slice.as_ptr();
|
84 | |
@@ -1233,7 +1233,7 @@ cfg_if! {
|
85 | |
}
|
86 | |
None
|
87 | |
}
|
88 | |
- } else if #[cfg(all(feature = "simd-accel", target_feature = "sse2"))] {
|
89 | |
+ } else if #[cfg(all(feature = "simd-accel-disabled", target_feature = "sse2"))] {
|
90 | |
#[inline(always)]
|
91 | |
pub fn validate_ascii(slice: &[u8]) -> Option<(u8, usize)> {
|
92 | |
let src = slice.as_ptr();
|
93 | |
@@ -1409,9 +1409,9 @@ cfg_if! {
|
94 | |
}
|
95 | |
|
96 | |
cfg_if! {
|
97 | |
- if #[cfg(all(feature = "simd-accel", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"))))] {
|
98 | |
+ if #[cfg(all(feature = "simd-accel-disabled", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"))))] {
|
99 | |
|
100 | |
- } else if #[cfg(all(feature = "simd-accel", target_endian = "little", target_feature = "neon"))] {
|
101 | |
+ } else if #[cfg(all(feature = "simd-accel-disabled", target_endian = "little", target_feature = "neon"))] {
|
102 | |
// Even with NEON enabled, we use the ALU path for ASCII validation, because testing
|
103 | |
// on Exynos 5 indicated that using NEON isn't worthwhile where there are only
|
104 | |
// vector reads without vector writes.
|
105 | |
--- a/src/handles.rs
|
106 | |
+++ b/src/handles.rs
|
107 | |
@@ -17,7 +17,7 @@
|
108 | |
//! bound check at the read/write time.
|
109 | |
|
110 | |
#[cfg(all(
|
111 | |
- feature = "simd-accel",
|
112 | |
+ feature = "simd-accel-disabled",
|
113 | |
any(
|
114 | |
target_feature = "sse2",
|
115 | |
all(target_endian = "little", target_arch = "aarch64"),
|
116 | |
@@ -27,7 +27,7 @@
|
117 | |
use simd_funcs::*;
|
118 | |
|
119 | |
#[cfg(all(
|
120 | |
- feature = "simd-accel",
|
121 | |
+ feature = "simd-accel-disabled",
|
122 | |
any(
|
123 | |
target_feature = "sse2",
|
124 | |
all(target_endian = "little", target_arch = "aarch64"),
|
125 | |
@@ -116,7 +116,7 @@ impl UnalignedU16Slice {
|
126 | |
}
|
127 | |
}
|
128 | |
|
129 | |
- #[cfg(feature = "simd-accel")]
|
130 | |
+ #[cfg(feature = "simd-accel-disabled")]
|
131 | |
#[inline(always)]
|
132 | |
pub fn simd_at(&self, i: usize) -> u16x8 {
|
133 | |
assert!(i + SIMD_STRIDE_SIZE / 2 <= self.len);
|
134 | |
@@ -137,7 +137,7 @@ impl UnalignedU16Slice {
|
135 | |
unsafe { UnalignedU16Slice::new(self.ptr.add(from * 2), self.len - from) }
|
136 | |
}
|
137 | |
|
138 | |
- #[cfg(feature = "simd-accel")]
|
139 | |
+ #[cfg(feature = "simd-accel-disabled")]
|
140 | |
#[inline(always)]
|
141 | |
pub fn copy_bmp_to<E: Endian>(&self, other: &mut [u16]) -> Option<(u16, usize)> {
|
142 | |
assert!(self.len <= other.len());
|
143 | |
@@ -172,7 +172,7 @@ impl UnalignedU16Slice {
|
144 | |
None
|
145 | |
}
|
146 | |
|
147 | |
- #[cfg(not(feature = "simd-accel"))]
|
148 | |
+ #[cfg(not(feature = "simd-accel-disabled"))]
|
149 | |
#[inline(always)]
|
150 | |
fn copy_bmp_to<E: Endian>(&self, other: &mut [u16]) -> Option<(u16, usize)> {
|
151 | |
assert!(self.len <= other.len());
|
152 | |
@@ -217,7 +217,7 @@ fn swap_if_opposite_endian<E: Endian>(unit: u16) -> u16 {
|
153 | |
}
|
154 | |
}
|
155 | |
|
156 | |
-#[cfg(not(feature = "simd-accel"))]
|
157 | |
+#[cfg(not(feature = "simd-accel-disabled"))]
|
158 | |
#[inline(always)]
|
159 | |
fn copy_unaligned_basic_latin_to_ascii<E: Endian>(
|
160 | |
src: UnalignedU16Slice,
|
161 | |
@@ -226,7 +226,7 @@ fn copy_unaligned_basic_latin_to_ascii<E: Endian>(
|
162 | |
copy_unaligned_basic_latin_to_ascii_alu::<E>(src, dst, 0)
|
163 | |
}
|
164 | |
|
165 | |
-#[cfg(feature = "simd-accel")]
|
166 | |
+#[cfg(feature = "simd-accel-disabled")]
|
167 | |
#[inline(always)]
|
168 | |
fn copy_unaligned_basic_latin_to_ascii<E: Endian>(
|
169 | |
src: UnalignedU16Slice,
|
170 | |
--- a/src/lib.rs
|
171 | |
+++ b/src/lib.rs
|
172 | |
@@ -665,13 +665,13 @@
|
173 | |
//! See the section [_UTF-16LE, UTF-16BE and Unicode Encoding Schemes_](#utf-16le-utf-16be-and-unicode-encoding-schemes)
|
174 | |
//! for discussion about the UTF-16 family.
|
175 | |
|
176 | |
-#![cfg_attr(feature = "simd-accel", feature(platform_intrinsics, core_intrinsics))]
|
177 | |
+#![cfg_attr(feature = "simd-accel-disabled", feature(platform_intrinsics, core_intrinsics))]
|
178 | |
|
179 | |
#[macro_use]
|
180 | |
extern crate cfg_if;
|
181 | |
|
182 | |
#[cfg(all(
|
183 | |
- feature = "simd-accel",
|
184 | |
+ feature = "simd-accel-disabled",
|
185 | |
any(
|
186 | |
target_feature = "sse2",
|
187 | |
all(target_endian = "little", target_arch = "aarch64"),
|
188 | |
@@ -695,7 +695,7 @@ extern crate serde_json;
|
189 | |
mod macros;
|
190 | |
|
191 | |
#[cfg(all(
|
192 | |
- feature = "simd-accel",
|
193 | |
+ feature = "simd-accel-disabled",
|
194 | |
any(
|
195 | |
target_feature = "sse2",
|
196 | |
all(target_endian = "little", target_arch = "aarch64"),
|
197 | |
--- a/src/mem.rs
|
198 | |
+++ b/src/mem.rs
|
199 | |
@@ -37,7 +37,7 @@ macro_rules! non_fuzz_debug_assert {
|
200 | |
}
|
201 | |
|
202 | |
cfg_if! {
|
203 | |
- if #[cfg(feature = "simd-accel")] {
|
204 | |
+ if #[cfg(feature = "simd-accel-disabled")] {
|
205 | |
use ::std::intrinsics::likely;
|
206 | |
use ::std::intrinsics::unlikely;
|
207 | |
} else {
|
208 | |
@@ -226,7 +226,7 @@ macro_rules! by_unit_check_simd {
|
209 | |
}
|
210 | |
|
211 | |
cfg_if! {
|
212 | |
- if #[cfg(all(feature = "simd-accel", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"), all(target_endian = "little", target_feature = "neon"))))] {
|
213 | |
+ if #[cfg(all(feature = "simd-accel-disabled", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"), all(target_endian = "little", target_feature = "neon"))))] {
|
214 | |
use simd_funcs::*;
|
215 | |
use simd::u8x16;
|
216 | |
use simd::u16x8;
|
217 | |
@@ -358,7 +358,7 @@ fn utf16_valid_up_to_alu(buffer: &[u16]) -> (usize, bool) {
|
218 | |
}
|
219 | |
|
220 | |
cfg_if! {
|
221 | |
- if #[cfg(all(feature = "simd-accel", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"), all(target_endian = "little", target_feature = "neon"))))] {
|
222 | |
+ if #[cfg(all(feature = "simd-accel-disabled", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"), all(target_endian = "little", target_feature = "neon"))))] {
|
223 | |
#[inline(always)]
|
224 | |
fn is_str_latin1_impl(buffer: &str) -> Option<usize> {
|
225 | |
let mut offset = 0usize;
|
226 | |
@@ -447,7 +447,7 @@ fn is_utf8_latin1_impl(buffer: &[u8]) -> Option<usize> {
|
227 | |
}
|
228 | |
|
229 | |
cfg_if! {
|
230 | |
- if #[cfg(all(feature = "simd-accel", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"), all(target_endian = "little", target_feature = "neon"))))] {
|
231 | |
+ if #[cfg(all(feature = "simd-accel-disabled", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"), all(target_endian = "little", target_feature = "neon"))))] {
|
232 | |
#[inline(always)]
|
233 | |
fn is_utf16_bidi_impl(buffer: &[u16]) -> bool {
|
234 | |
let mut offset = 0usize;
|
235 | |
@@ -497,7 +497,7 @@ cfg_if! {
|
236 | |
}
|
237 | |
|
238 | |
cfg_if! {
|
239 | |
- if #[cfg(all(feature = "simd-accel", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"), all(target_endian = "little", target_feature = "neon"))))] {
|
240 | |
+ if #[cfg(all(feature = "simd-accel-disabled", any(target_feature = "sse2", all(target_endian = "little", target_arch = "aarch64"), all(target_endian = "little", target_feature = "neon"))))] {
|
241 | |
#[inline(always)]
|
242 | |
fn check_utf16_for_latin1_and_bidi_impl(buffer: &[u16]) -> Latin1Bidi {
|
243 | |
let mut offset = 0usize;
|
244 | |
--- a/src/utf_8.rs
|
245 | |
+++ b/src/utf_8.rs
|
246 | |
@@ -16,7 +16,7 @@ use mem::convert_utf16_to_utf8_partial;
|
247 | |
use variant::*;
|
248 | |
|
249 | |
cfg_if! {
|
250 | |
- if #[cfg(feature = "simd-accel")] {
|
251 | |
+ if #[cfg(feature = "simd-accel-disabled")] {
|
252 | |
use ::std::intrinsics::unlikely;
|
253 | |
use ::std::intrinsics::likely;
|
254 | |
} else {
|
255 | |
--- a/src/x_user_defined.rs
|
256 | |
+++ b/src/x_user_defined.rs
|
257 | |
@@ -12,7 +12,7 @@ use handles::*;
|
258 | |
use variant::*;
|
259 | |
|
260 | |
cfg_if! {
|
261 | |
- if #[cfg(feature = "simd-accel")] {
|
262 | |
+ if #[cfg(feature = "simd-accel-disabled")] {
|
263 | |
use simd_funcs::*;
|
264 | |
use simd::u16x8;
|
265 | |
|
266 | |
@@ -72,7 +72,7 @@ impl UserDefinedDecoder {
|
267 | |
Utf8Destination
|
268 | |
);
|
269 | |
|
270 | |
- #[cfg(not(feature = "simd-accel"))]
|
271 | |
+ #[cfg(not(feature = "simd-accel-disabled"))]
|
272 | |
pub fn decode_to_utf16_raw(
|
273 | |
&mut self,
|
274 | |
src: &[u8],
|
275 | |
@@ -102,7 +102,7 @@ impl UserDefinedDecoder {
|
276 | |
(pending, length, length)
|
277 | |
}
|
278 | |
|
279 | |
- #[cfg(feature = "simd-accel")]
|
280 | |
+ #[cfg(feature = "simd-accel-disabled")]
|
281 | |
pub fn decode_to_utf16_raw(
|
282 | |
&mut self,
|
283 | |
src: &[u8],
|