Skip to content

Commit f53a807

Browse files
committed
fix test compilation of swar on 32bit
1 parent 5ec9f60 commit f53a807

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/simd/avx2.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
#[cfg(target_arch = "x86")]
2-
pub(crate) unsafe fn match_uri_vectored(_: &[u8]) -> usize {
3-
unreachable!("AVX2 detection should be disabled for x86");
4-
}
5-
61
#[inline]
7-
#[cfg(target_arch = "x86_64")]
82
#[target_feature(enable = "avx2", enable = "sse4.2")]
93
pub(crate) unsafe fn match_uri_vectored(bytes: &[u8]) -> usize {
104
let mut len = 0usize;
@@ -26,6 +20,7 @@ pub(crate) unsafe fn match_uri_vectored(bytes: &[u8]) -> usize {
2620

2721
#[inline(always)]
2822
#[allow(non_snake_case, overflowing_literals)]
23+
#[allow(unused)]
2924
unsafe fn match_url_char_32_avx(buf: &[u8]) -> usize {
3025
debug_assert!(buf.len() >= 32);
3126

@@ -64,12 +59,6 @@ unsafe fn match_url_char_32_avx(buf: &[u8]) -> usize {
6459
r.trailing_zeros() as usize
6560
}
6661

67-
#[cfg(target_arch = "x86")]
68-
pub(crate) unsafe fn match_header_value_vectored(_: &[u8]) -> usize {
69-
unreachable!("AVX2 detection should be disabled for x86");
70-
}
71-
72-
#[cfg(target_arch = "x86_64")]
7362
#[target_feature(enable = "avx2", enable = "sse4.2")]
7463
pub(crate) unsafe fn match_header_value_vectored(bytes: &[u8]) -> usize {
7564
let mut len = 0usize;
@@ -91,6 +80,7 @@ pub(crate) unsafe fn match_header_value_vectored(bytes: &[u8]) -> usize {
9180

9281
#[inline(always)]
9382
#[allow(non_snake_case)]
83+
#[allow(unused)]
9484
unsafe fn match_header_value_char_32_avx(buf: &[u8]) -> usize {
9585
debug_assert!(buf.len() >= 32);
9686

src/simd/swar.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,13 @@ fn test_is_header_value_block() {
190190
assert!(!is_header_value_block([b; BLOCK_SIZE]), "b={}", b);
191191
}
192192

193-
// A few sanity checks on non-uniform bytes for safe-measure
194-
assert!(!is_header_value_block(*b"foo.com\n"));
195-
assert!(!is_header_value_block(*b"o.com\r\nU"));
193+
194+
#[cfg(target_pointer_width = "64")]
195+
{
196+
// A few sanity checks on non-uniform bytes for safe-measure
197+
assert!(!is_header_value_block(*b"foo.com\n"));
198+
assert!(!is_header_value_block(*b"o.com\r\nU"));
199+
}
196200
}
197201

198202
#[test]

0 commit comments

Comments
 (0)