aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/hash64.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2015-01-06 16:42:48 -0800
committerKeith Randall <khr@golang.org>2015-01-07 21:57:01 +0000
commitd5e4c4061b019a36ed3ac954c98f6535b7e78189 (patch)
treeaf24f48eccd739765e7ac27a2f03f07b389b3873 /src/runtime/hash64.go
parent60801c48530f5fc0555d8156006c1a41fdf53571 (diff)
downloadgo-d5e4c4061b019a36ed3ac954c98f6535b7e78189.tar.gz
go-d5e4c4061b019a36ed3ac954c98f6535b7e78189.zip
runtime: remove size argument from hash and equal algorithms
The equal algorithm used to take the size equal(p, q *T, size uintptr) bool With this change, it does not equal(p, q *T) bool Similarly for the hash algorithm. The size is rarely used, as most equal functions know the size of the thing they are comparing. For instance f32equal already knows its inputs are 4 bytes in size. For cases where the size is not known, we allocate a closure (one for each size needed) that points to an assembly stub that reads the size out of the closure and calls generic code that has a size argument. Reduces the size of the go binary by 0.07%. Performance impact is not measurable. Change-Id: I6e00adf3dde7ad2974adbcff0ee91e86d2194fec Reviewed-on: https://go-review.googlesource.com/2392 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/hash64.go')
-rw-r--r--src/runtime/hash64.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/hash64.go b/src/runtime/hash64.go
index 4a52d98996..d10b781197 100644
--- a/src/runtime/hash64.go
+++ b/src/runtime/hash64.go
@@ -20,9 +20,9 @@ const (
m4 = 15839092249703872147
)
-func memhash(p unsafe.Pointer, s, seed uintptr) uintptr {
+func memhash(p unsafe.Pointer, seed, s uintptr) uintptr {
if GOARCH == "amd64" && GOOS != "nacl" && useAeshash {
- return aeshash(p, s, seed)
+ return aeshash(p, seed, s)
}
h := uint64(seed + s*hashkey[0])
tail: