mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: Smhasher tests of our map hash function.
R=golang-dev, rsc CC=golang-dev https://golang.org/cl/13436045
This commit is contained in:
parent
da7a51d16b
commit
78338d8c66
3 changed files with 550 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue