diff options
| author | Tyge Løvset <[email protected]> | 2020-11-04 14:32:50 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-11-04 14:32:50 +0100 |
| commit | 53d2199dff3dfd3a80c56877c1fa8c26c8c16124 (patch) | |
| tree | 7de8c09cddac9f5e0d9bd5260fde0eba4c0570e2 | |
| parent | 96a572458d7ab43d19b060a867cf80c37b6473ec (diff) | |
| download | STC-modified-53d2199dff3dfd3a80c56877c1fa8c26c8c16124.tar.gz STC-modified-53d2199dff3dfd3a80c56877c1fa8c26c8c16124.zip | |
Larger constant Phi in hash16.
| -rw-r--r-- | stc/ccommon.h | 2 | ||||
| -rw-r--r-- | stc/cmap.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/stc/ccommon.h b/stc/ccommon.h index 75567256..3cda038d 100644 --- a/stc/ccommon.h +++ b/stc/ccommon.h @@ -76,7 +76,7 @@ #endif
#define c_swap(T, x, y) do { T __t = x; x = y; y = __t; } while (0)
#define c_no_compare(x, y) (0)
-#define c_mem_equals(x, y) (memcmp(x, y, sizeof(*(y))) == 0)
+#define c_mem_equals(x, y) (memcmp(x, y, sizeof *(x)) == 0)
#define c_default_equals(x, y) (*(x) == *(y))
#define c_default_less(x, y) (*(x) < *(y))
#define c_less_compare(less, x, y) (less(y, x) - less(x, y))
@@ -445,8 +445,8 @@ typedef struct {size_t idx; uint32_t hx;} cmap_bucket_t, cset_bucket_t; STC_DEF uint32_t c_default_hash16(const void *data, size_t len) {
const volatile uint16_t *key = (const uint16_t *) data;
- uint64_t x = *key++ * 0xc613fc15u;
- while (len -= 2) x = (*key++ + x) * 2654435769ull;
+ uint64_t x = *key++ * 11400714819323198485llu;
+ while (len -= 2) x = (*key++ + x) * 11400714819323198485llu;
return (uint32_t) x;
}
STC_DEF uint32_t c_default_hash32(const void* data, size_t len) {
|
