ld: implement an actual program loader
This commit is contained in:
16
sys/ld/hash.c
Normal file
16
sys/ld/hash.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#define BASIS 0xcbf29ce484222325
|
||||
#define PRIME 0x100000001b3
|
||||
|
||||
uint64_t hash_string(const char *s)
|
||||
{
|
||||
uint64_t result = BASIS;
|
||||
|
||||
for (unsigned int i = 0; s[i]; i++) {
|
||||
result ^= s[i];
|
||||
result *= PRIME;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user