Skip to content

Commit

Permalink
sort: drop implementation for Go <1.21
Browse files Browse the repository at this point in the history
Now that Go 1.22.6 is the minimum bootstrap toolchain (cf. CL 606156),
the fallback implementation for Go versions <1.21 can be dropped.

For #61180
For #64751

Change-Id: Idfeca0a6e9f490e1ab0f308ead372612402923ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/607315
Reviewed-by: Dmitri Shuralyov <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Commit-Queue: Tobias Klauser <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Auto-Submit: Tobias Klauser <[email protected]>
  • Loading branch information
tklauser authored and gopherbot committed Aug 21, 2024
1 parent 440c9ee commit b5ee80a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 44 deletions.
17 changes: 10 additions & 7 deletions src/sort/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
// Package sort provides primitives for sorting slices and user-defined collections.
package sort

import "math/bits"
import (
"math/bits"
"slices"
)

// An implementation of Interface can be sorted by the routines in this package.
// The methods refer to elements of the underlying collection by integer index.
Expand Down Expand Up @@ -162,34 +165,34 @@ func (x StringSlice) Sort() { Sort(x) }
// Ints sorts a slice of ints in increasing order.
//
// Note: as of Go 1.22, this function simply calls [slices.Sort].
func Ints(x []int) { intsImpl(x) }
func Ints(x []int) { slices.Sort(x) }

// Float64s sorts a slice of float64s in increasing order.
// Not-a-number (NaN) values are ordered before other values.
//
// Note: as of Go 1.22, this function simply calls [slices.Sort].
func Float64s(x []float64) { float64sImpl(x) }
func Float64s(x []float64) { slices.Sort(x) }

// Strings sorts a slice of strings in increasing order.
//
// Note: as of Go 1.22, this function simply calls [slices.Sort].
func Strings(x []string) { stringsImpl(x) }
func Strings(x []string) { slices.Sort(x) }

// IntsAreSorted reports whether the slice x is sorted in increasing order.
//
// Note: as of Go 1.22, this function simply calls [slices.IsSorted].
func IntsAreSorted(x []int) bool { return intsAreSortedImpl(x) }
func IntsAreSorted(x []int) bool { return slices.IsSorted(x) }

// Float64sAreSorted reports whether the slice x is sorted in increasing order,
// with not-a-number (NaN) values before any other values.
//
// Note: as of Go 1.22, this function simply calls [slices.IsSorted].
func Float64sAreSorted(x []float64) bool { return float64sAreSortedImpl(x) }
func Float64sAreSorted(x []float64) bool { return slices.IsSorted(x) }

// StringsAreSorted reports whether the slice x is sorted in increasing order.
//
// Note: as of Go 1.22, this function simply calls [slices.IsSorted].
func StringsAreSorted(x []string) bool { return stringsAreSortedImpl(x) }
func StringsAreSorted(x []string) bool { return slices.IsSorted(x) }

// Notes on stable sorting:
// The used algorithms are simple and provable correct on all input and use
Expand Down
15 changes: 0 additions & 15 deletions src/sort/sort_impl_120.go

This file was deleted.

22 changes: 0 additions & 22 deletions src/sort/sort_impl_go121.go

This file was deleted.

0 comments on commit b5ee80a

Please sign in to comment.