MCPcopy Create free account
hub / github.com/git/git / hash

Function hash

t/helper/test-hashmap.c:55–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53#define TEST_SIZE 100000
54
55static unsigned int hash(unsigned int method, unsigned int i, const char *key)
56{
57 unsigned int hash = 0;
58 switch (method & 3)
59 {
60 case HASH_METHOD_FNV:
61 hash = strhash(key);
62 break;
63 case HASH_METHOD_I:
64 hash = i;
65 break;
66 case HASH_METHOD_IDIV10:
67 hash = i / 10;
68 break;
69 case HASH_METHOD_0:
70 hash = 0;
71 break;
72 }
73
74 if (method & HASH_METHOD_X2)
75 hash = 2 * hash;
76 return hash;
77}
78
79/*
80 * Test performance of hashmap.[ch]

Callers 1

perf_hashmapFunction · 0.85

Calls 1

strhashFunction · 0.85

Tested by

no test coverage detected