aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootstrap/all.h17
-rw-r--r--bootstrap/util.c19
2 files changed, 19 insertions, 17 deletions
diff --git a/bootstrap/all.h b/bootstrap/all.h
index ff20c25..3410d1f 100644
--- a/bootstrap/all.h
+++ b/bootstrap/all.h
@@ -448,20 +448,11 @@ bswap64(u64 x) {
/////////////////////////////////
/** util.c **/
-#define FNV1A_INI 0x84222325u
+#define FNV1A_INI 0x811c9dc5u
u32 fnv1a(u32 hash, const void *data, size_t length);
-static inline u32
-fnv1ai(u32 hash, int i) {
- return fnv1a(hash, &i, sizeof i);
-}
-static inline u32
-fnv1aI(u32 hash, i64 i) {
- return fnv1a(hash, &i, sizeof i);
-}
-static inline u32
-fnv1az(u32 hash, size_t i) {
- return fnv1a(hash, &i, sizeof i);
-}
+u32 fnv1ai(u32 hash, int i);
+u32 fnv1aI(u32 hash, i64 i);
+u32 fnv1az(u32 hash, size_t i);
int addfilepath(const char *);
const char *fileid2path(int);
void *xmalloc(size_t);
diff --git a/bootstrap/util.c b/bootstrap/util.c
index bd6f951..43aa1b4 100644
--- a/bootstrap/util.c
+++ b/bootstrap/util.c
@@ -4,12 +4,23 @@ u32
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 *= 0x100000001b3;
+ h ^= data[i++];
+ h *= 0x01000193;
}
- return H;
+ return h;
+}
+u32
+fnv1ai(u32 hash, int i) {
+ return fnv1a(hash, &i, sizeof i);
+}
+u32
+fnv1aI(u32 hash, i64 i) {
+ return fnv1a(hash, &i, sizeof i);
+}
+u32
+fnv1az(u32 hash, size_t i) {
+ return fnv1a(hash, &i, sizeof i);
}
static const char *filepaths[100];