diff options
| author | 2025-12-09 19:18:12 +0100 | |
|---|---|---|
| committer | 2025-12-09 19:18:12 +0100 | |
| commit | 76e8fd27155f5a72298fa75632e865e25bb8e3e0 (patch) | |
| tree | 3f24a9173251d96c22c3fabd769659a80250b7e5 /common.h | |
| parent | 54dba7cc860808c8d2417a2abdaa8aa8412e8b49 (diff) | |
lex: make some hashtables resizable
Was hiting the fixed limits trying to preprocess sqlite3amalgamation
Diffstat (limited to 'common.h')
| -rw-r--r-- | common.h | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -45,23 +45,22 @@ void _assertfmt(const char *file, int line, const char *func, const char *expr); #define assert(x) (void)(!(x) ? _assertfmt(__FILE__,__LINE__,__func__,#x), *(volatile int *)0 : 0) #endif -static inline uint -hashs(uint h, const char *s) +static inline size_t +hashs(size_t h, const char *s) { while (*s) h = (uchar)*s++ + h*65599; return h; } -static inline uint -hashb(uint h, const void *d, uint n) +static inline size_t +hashb(size_t h, const void *d, size_t n) { - const uchar *b = d; while (n--) h = *b++ + h*65599; return h; } -static inline uint +static inline size_t ptrhash(const void *p) { - return (uint)(size_t)p * 2654435761u; + return (size_t)p * 2654435761u; } static inline uint popcnt(uvlong x) { |