From b46aec07655bb5536fd9b9dbff0680de805214e8 Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Fri, 27 Oct 2023 15:01:35 +0000 Subject: bytes,internal/bytealg: eliminate HashStrBytes,HashStrRevBytes using … MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …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 Reviewed-by: David Chase Reviewed-by: Keith Randall Auto-Submit: Keith Randall LUCI-TryBot-Result: Go LUCI --- src/bytes/bytes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bytes/bytes.go') 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-- { -- cgit v1.3