Skip to content

Commit 34257dd

Browse files
committed
blocksort.rs: make mainGtU easier to vectorize, step 5
1 parent 92f7bd7 commit 34257dd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

libbz2-rs-sys/src/blocksort.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,14 @@ fn mainGtU(
414414
let q1 = &quadrant[i1 as usize..][..8];
415415
let q2 = &quadrant[i2 as usize..][..8];
416416

417-
for (((c1, c2), s1), s2) in b1.iter().zip(b2).zip(q1).zip(q2) {
418-
if c1 != c2 {
419-
return c1 > c2;
420-
}
421-
if s1 != s2 {
422-
return s1 > s2;
417+
if b1 != b2 || q1 != q2 {
418+
for (((c1, c2), s1), s2) in b1.iter().zip(b2).zip(q1).zip(q2) {
419+
if c1 != c2 {
420+
return c1 > c2;
421+
}
422+
if s1 != s2 {
423+
return s1 > s2;
424+
}
423425
}
424426
}
425427

@@ -432,6 +434,7 @@ fn mainGtU(
432434
if i2 >= nblock {
433435
i2 = i2.wrapping_sub(nblock);
434436
}
437+
435438
*budget -= 1;
436439
}
437440

0 commit comments

Comments
 (0)