diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-04-08 13:14:27 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-04-08 13:15:01 +0200 |
| commit | cf534d762754860ed5b714974f99acd282d48b3b (patch) | |
| tree | bf22341cedfb50ee7bcd4e15f85add2329783f31 /src/str.c | |
| parent | 630fcb1846aed16b9ab62bcf700f668883f4521f (diff) | |
Restructure into src/{std,json}/
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/str.c')
| -rw-r--r-- | src/str.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/str.c b/src/str.c deleted file mode 100644 index 3523d98..0000000 --- a/src/str.c +++ /dev/null @@ -1,32 +0,0 @@ -#include <stdint.h> -#include <stdio.h> -#include <string.h> - -#include "../include/memory.h" -#include "../include/str.h" - -u64 Str_hash64(Str s) { - u64 h = 0x100; - for (size i = 0; i < s.len; i++) { - h ^= s.data[i] & 255; - h *= 1111111111111111111; - } - return h; -} - -Str Str_copy(Arena *a, byte *data, size len) { - Str str = {0}; - str.len = len; - str.data = new(a, byte, len); - if (str.len) memcpy(str.data, data, len); - return str; -} - -StrView Str_view(byte *data, size len) { - StrView str = {0}; - str.len = len; - str.data = data; - return str; -} - -Str StrView_copy(Arena *a, StrView s) { return Str_copy(a, s.data, s.len); } |
