Skip to content

Commit

Permalink
fix(array): other sort same pred opt
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 authored and bobzhang committed Dec 2, 2024
1 parent 5b4d19e commit 4660d8b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion array/fixedarray_sort.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ fn fixed_quick_sort[T : Compare](
// Reduce the stack depth by only call fixed_quick_sort on the smaller fixed_partition.
if left.length() < right.length() {
fixed_quick_sort(left, pred, limit)
arr = right
pred = Some(arr[pivot])
arr = right
} else {
fixed_quick_sort(right, Some(arr[pivot]), limit)
arr = left
Expand Down
2 changes: 1 addition & 1 deletion array/fixedarray_sort_by.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ fn fixed_quick_sort_by[T](
// Reduce the stack depth by only call quick_sort on the smaller partition.
if left.length() < right.length() {
fixed_quick_sort_by(left, cmp, pred, limit)
arr = right
pred = Some(arr[pivot])
arr = right
} else {
fixed_quick_sort_by(right, cmp, Some(arr[pivot]), limit)
arr = left
Expand Down
2 changes: 1 addition & 1 deletion array/sort_by.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ fn quick_sort_by[T](
// Reduce the stack depth by only call quick_sort on the smaller partition.
if left.length() < right.length() {
quick_sort_by(left, cmp, pred, limit)
arr = right
pred = Some(arr[pivot])
arr = right
} else {
quick_sort_by(right, cmp, Some(arr[pivot]), limit)
arr = left
Expand Down

0 comments on commit 4660d8b

Please sign in to comment.