diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-06-22 13:25:24 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-06-22 13:26:22 +0200 |
commit | 0c83d031ff793f364b86bcf557584580edfe66a5 (patch) | |
tree | beef319096e8545d7dbf0091e46a57626c27ea1f /src/strview.c | |
parent | 9e127d92246d6577792122b013088466e3688da1 (diff) |
Rename lots of things to make my life easier
Diffstat (limited to 'src/strview.c')
-rw-r--r-- | src/strview.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/strview.c b/src/strview.c index f9b80e4..70e78f0 100644 --- a/src/strview.c +++ b/src/strview.c @@ -1,13 +1,14 @@ #include <string.h> +#include "common.h" #include "strview.h" #include "types.h" uint64_t -strview_hash(struct strview sv) +strview_hash(strview_t sv) { uint64_t h = 0x100; - for (size_t i = 0; i < sv.len; i++) { + for (size_t i = 0; likely(i < sv.len); i++) { h ^= sv.p[i]; h *= 1111111111111111111u; } @@ -15,9 +16,8 @@ strview_hash(struct strview sv) } uchar * -svtocstr(uchar *dst, struct strview src) +svtocstr(uchar *dst, strview_t src) { - memcpy(dst, src.p, src.len); - dst[src.len] = 0; + ((uchar *)memcpy(dst, src.p, src.len))[src.len] = 0; return dst; } |