From 3aa7adbaa633f0944044181a359eef6dec2c5975 Mon Sep 17 00:00:00 2001 From: Nathan Essex Date: Sat, 3 Feb 2024 01:28:40 +0900 Subject: [PATCH] Fix get_counts already sorted check on lsb_sort --- src/sorts/lsb_sort.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sorts/lsb_sort.rs b/src/sorts/lsb_sort.rs index 367e986..9e26f36 100644 --- a/src/sorts/lsb_sort.rs +++ b/src/sorts/lsb_sort.rs @@ -62,7 +62,12 @@ impl<'a> Sorter<'a> { } else if let Some(next_counts) = next_counts { next_counts } else { - let (counts, already_sorted) = get_counts(bucket, level); + let (counts, already_sorted) = if invert { + get_counts(&tmp_bucket, level) + } else { + get_counts(bucket, level) + }; + if already_sorted { next_counts = None; continue 'outer;