summaryrefslogtreecommitdiffhomepage
path: root/docs/cmap_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-04-25 20:03:04 +0200
committerTyge Løvset <[email protected]>2022-04-25 20:03:04 +0200
commit29b1fb689c71837616023b3adc78eda3d32026b2 (patch)
tree63f0bd3532f1819fb31d32c9c1c203eade79ea0c /docs/cmap_api.md
parent72b40c6f5bbfbf11eba112a42ca5536c4c8e7d8f (diff)
downloadSTC-modified-29b1fb689c71837616023b3adc78eda3d32026b2.tar.gz
STC-modified-29b1fb689c71837616023b3adc78eda3d32026b2.zip
Removed size argument to `i_hash` template parameter and `c_default_hash`. This was a "design error", and is not worth keeping for backward compability. Please update your code where you use i_hash template parameter (simply remove second argument).
Diffstat (limited to 'docs/cmap_api.md')
-rw-r--r--docs/cmap_api.md11
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/cmap_api.md b/docs/cmap_api.md
index d51df6b2..a730bee0 100644
--- a/docs/cmap_api.md
+++ b/docs/cmap_api.md
@@ -85,10 +85,9 @@ cmap_X_raw cmap_X_value_toraw(cmap_X_value* pval);
```
Helpers:
```c
-uint64_t c_strhash(const char *str); // utility function
-
-// hash template parameter functions:
-uint64_t c_default_hash(const void *data, size_t len); // key is any integral type
+uint64_t c_default_hash(const X *obj); // macro, calls c_fasthash(obj, sizeof *obj)
+uint64_t c_strhash(const char *str); // string hash funcion, uses strlen()
+uint64_t c_fasthash(const void *data, size_t len); // base hash function
// equalto template parameter functions:
bool c_default_eq(const i_keyraw* a, const i_keyraw* b); // *a == *b
@@ -278,7 +277,7 @@ static inline int Viking_cmp(const Viking* a, const Viking* b) {
return c ? c : cstr_cmp(&a->country, &b->country);
}
-static inline uint32_t Viking_hash(const Viking* a, int ignored) {
+static inline uint32_t Viking_hash(const Viking* a) {
return c_strhash(cstr_str(&a->name)) ^ (c_strhash(cstr_str(&a->country)) >> 15);
}
@@ -355,7 +354,7 @@ typedef struct RViking {
const char* country;
} RViking;
-static inline uint64_t RViking_hash(const RViking* raw, size_t ignore) {
+static inline uint64_t RViking_hash(const RViking* raw) {
uint64_t hash = c_strhash(raw->name) ^ (c_strhash(raw->country) >> 15);
return hash;
}