diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
commit | 758ff64c69e34965f8af5b2d6ffd65e8d7ab2150 (patch) | |
tree | 6d6b34f8c678862fe9b56c945a7b63f68502c245 /src/pkg/sort/search.go | |
parent | 3e45412327a2654a77944249962b3652e6142299 (diff) | |
download | golang-upstream/2011-02-01.1.tar.gz |
Imported Upstream version 2011-02-01.1upstream/2011-02-01.1
Diffstat (limited to 'src/pkg/sort/search.go')
-rw-r--r-- | src/pkg/sort/search.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pkg/sort/search.go b/src/pkg/sort/search.go index b3ddd2dfa..6828e19b6 100644 --- a/src/pkg/sort/search.go +++ b/src/pkg/sort/search.go @@ -74,7 +74,7 @@ func Search(n int, f func(int) bool) int { // Convenience wrappers for common cases. -// SearchInts searches x in a sorted slice of ints and returns the index +// SearchInts searches for x in a sorted slice of ints and returns the index // as specified by Search. The array must be sorted in ascending order. // func SearchInts(a []int, x int) int { @@ -82,15 +82,15 @@ func SearchInts(a []int, x int) int { } -// SearchFloats searches x in a sorted slice of floats and returns the index +// SearchFloat64s searches for x in a sorted slice of float64s and returns the index // as specified by Search. The array must be sorted in ascending order. // -func SearchFloats(a []float, x float) int { +func SearchFloat64s(a []float64, x float64) int { return Search(len(a), func(i int) bool { return a[i] >= x }) } -// SearchStrings searches x in a sorted slice of strings and returns the index +// SearchStrings searches for x in a sorted slice of strings and returns the index // as specified by Search. The array must be sorted in ascending order. // func SearchStrings(a []string, x string) int { @@ -102,8 +102,8 @@ func SearchStrings(a []string, x string) int { func (p IntArray) Search(x int) int { return SearchInts(p, x) } -// Search returns the result of applying SearchFloats to the receiver and x. -func (p FloatArray) Search(x float) int { return SearchFloats(p, x) } +// Search returns the result of applying SearchFloat64s to the receiver and x. +func (p Float64Array) Search(x float64) int { return SearchFloat64s(p, x) } // Search returns the result of applying SearchStrings to the receiver and x. |