Skip to content

Commit

Permalink
Check arch before is_x86_feature_detected
Browse files Browse the repository at this point in the history
I believe this was the source of #1311
  • Loading branch information
cmyr committed Jun 26, 2021
1 parent a134f80 commit 849c0b1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rust/rope/src/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 482,13 @@ mod tests {
];

assert_eq!(ne_idx_rev_fallback(one, two), Some(1));
if is_x86_feature_detected!("sse4.2") {
unsafe {
assert_eq!(ne_idx_rev_sse(one, two), Some(1));

#[cfg(target_arch = "x86_64")]
{
if is_x86_feature_detected!("sse4.2") {
unsafe {
assert_eq!(ne_idx_rev_sse(one, two), Some(1));
}
}
}
}
Expand Down Expand Up @@ -666,6 670,7 @@ mod tests {
let zer = "baaaa";
let one = "🍄aaaa"; // F0 9F 8D 84 61 61 61 61;
let two = "🙄aaaa"; // F0 9F 99 84 61 61 61 61;
#[cfg(target_arch = "x86_64")]
if is_x86_feature_detected!("sse4.2") {
unsafe {
assert_eq!(ne_idx_rev_sse(zer.as_bytes(), one.as_bytes()), Some(4));
Expand All @@ -677,6 682,7 @@ mod tests {
}

#[test]
#[cfg(target_arch = "x86_64")]
fn avx_mask() {
if !is_x86_feature_detected!("avx2") {
return;
Expand All @@ -695,6 701,7 @@ mod tests {
}

#[test]
#[cfg(target_arch = "x86_64")]
fn ne_avx() {
if !is_x86_feature_detected!("avx2") {
return;
Expand Down

0 comments on commit 849c0b1

Please sign in to comment.