diff options
author | Jes Cok <xigua67damn@gmail.com> | 2023-10-27 15:01:35 +0000 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-10-27 15:55:16 +0000 |
commit | b46aec07655bb5536fd9b9dbff0680de805214e8 (patch) | |
tree | 78911e10a1b2aa042de4c0255fcc1c151577620b /src/bytes | |
parent | 0262ea1ff9ac3b9fd268a48fcaaa6811c20cbea2 (diff) | |
download | go-b46aec07655bb5536fd9b9dbff0680de805214e8.tar.gz go-b46aec07655bb5536fd9b9dbff0680de805214e8.zip |
bytes,internal/bytealg: eliminate HashStrBytes,HashStrRevBytes using …
…generics
The logic of HashStrBytes, HashStrRevBytes and HashStr, HashStrRev,
are exactly the same, except that the types are different.
Since the bootstrap toolchain is bumped to 1.20, we can eliminate them
by using generics.
Change-Id: I4336b1cab494ba963f09646c169b45f6b1ee62e3
GitHub-Last-Rev: b11a2bf9476d54bed4bd18a3f9269b5c95a66d67
GitHub-Pull-Request: golang/go#63766
Reviewed-on: https://go-review.googlesource.com/c/go/+/538175
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/bytes')
-rw-r--r-- | src/bytes/bytes.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go index 9ee66cae4e..95afb30b40 100644 --- a/src/bytes/bytes.go +++ b/src/bytes/bytes.go @@ -122,7 +122,7 @@ func LastIndex(s, sep []byte) int { return -1 } // Rabin-Karp search from the end of the string - hashss, pow := bytealg.HashStrRevBytes(sep) + hashss, pow := bytealg.HashStrRev(sep) last := len(s) - n var h uint32 for i := len(s) - 1; i >= last; i-- { |