aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/util.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-06 14:10:19 +0200
committerlemon <lsof@mailbox.org>2022-08-06 14:10:29 +0200
commitb8d9ad1f6636f46a832b0f949ce7525ae08f53bd (patch)
tree037c7e0a86835b2e284df786e3ba2680b7677cc4 /bootstrap/util.c
parent1dd19e56fb81d1334bb21e4aa097f9593576feb7 (diff)
basic method calls & many bugfix
Diffstat (limited to 'bootstrap/util.c')
-rw-r--r--bootstrap/util.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/bootstrap/util.c b/bootstrap/util.c
index c9be845..bd6f951 100644
--- a/bootstrap/util.c
+++ b/bootstrap/util.c
@@ -1,18 +1,15 @@
#include "all.h"
-// Bob Jenkins's one_at_a_time hash
u32
-jkhash(u32 h, const u8 *data, size_t length) {
+fnv1a(u32 h, const void *p, size_t length) {
+ const u8 *data = p;
size_t i = 0;
+ u64 H = h;
while (i != length) {
- h += data[i++];
- h += h << 10;
- h ^= h >> 6;
+ H ^= data[i++];
+ H *= 0x100000001b3;
}
- h += h << 3;
- h ^= h >> 11;
- h += h << 15;
- return h;
+ return H;
}
static const char *filepaths[100];
@@ -117,7 +114,7 @@ eprifileline(struct span span) {
--j;
n = fprintf(stderr, "%4d| ", span.line);
- for (long k = i; k < j; ++k)
+ for (long k = i; k <= j; ++k)
epri("%c", src[k]);
epri("\n");
while (n--)