Commit 78338d8c authored by Keith Randall's avatar Keith Randall

runtime: Smhasher tests of our map hash function.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13436045
parent da7a51d1
......@@ -513,3 +513,29 @@ runtime·equal(Type *t, ...)
ret = ROUND(ret, Structrnd);
t->alg->equal((bool*)ret, t->size, x, y);
}
// Testing adapters for hash quality tests (see hash_test.go)
void runtime·haveGoodHash(bool res) {
res = use_aeshash;
FLUSH(&res);
}
void runtime·stringHash(String s, uintptr seed, uintptr res) {
runtime·algarray[ASTRING].hash(&seed, sizeof(String), &s);
res = seed;
FLUSH(&res);
}
void runtime·bytesHash(Slice s, uintptr seed, uintptr res) {
runtime·algarray[AMEM].hash(&seed, s.len, s.array);
res = seed;
FLUSH(&res);
}
void runtime·int32Hash(uint32 i, uintptr seed, uintptr res) {
runtime·algarray[AMEM32].hash(&seed, sizeof(uint32), &i);
res = seed;
FLUSH(&res);
}
void runtime·int64Hash(uint64 i, uintptr seed, uintptr res) {
runtime·algarray[AMEM64].hash(&seed, sizeof(uint64), &i);
res = seed;
FLUSH(&res);
}
......@@ -67,3 +67,15 @@ func testSchedLocalQueueSteal()
var TestSchedLocalQueue1 = testSchedLocalQueue
var TestSchedLocalQueueSteal1 = testSchedLocalQueueSteal
func haveGoodHash() bool
func stringHash(s string, seed uintptr) uintptr
func bytesHash(b []byte, seed uintptr) uintptr
func int32Hash(i uint32, seed uintptr) uintptr
func int64Hash(i uint64, seed uintptr) uintptr
var HaveGoodHash = haveGoodHash
var StringHash = stringHash
var BytesHash = bytesHash
var Int32Hash = int32Hash
var Int64Hash = int64Hash
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment