Hunt down some small bugs

This commit is contained in:
Justine Tunney 2020-12-24 16:01:48 -08:00
parent 95b142e4e5
commit 830334d767
15 changed files with 1156 additions and 83 deletions

View file

@ -163,7 +163,6 @@ int main(int argc, char *argv[]) {
CONCAT(&filenames.p, &filenames.i, &filenames.n, "/\n", 2);
CHECK_NE(MAP_FAILED,
(elf = mmap(NULL, st->st_size, PROT_READ, MAP_PRIVATE, fd, 0)));
madvise(elf, st->st_size, MADV_WILLNEED);
CHECK(IsElf64Binary(elf, st->st_size));
CHECK_NOTNULL((strs = GetElfStringTable(elf, st->st_size)));
CHECK_NOTNULL((syms = GetElfSymbolTable(elf, st->st_size, &symcount)));

View file

@ -21,7 +21,7 @@
#include "libc/alg/arraylist2.internal.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/mem/mem.h"
#include "libc/str/knuthmultiplicativehash.internal.h"
#include "libc/nexgen32e/crc32.h"
#include "libc/str/str.h"
#include "libc/x/x.h"
#include "tool/build/lib/interner.h"
@ -100,7 +100,7 @@ size_t internobj(struct Interner *t, const void *data, size_t size) {
step = 0;
item = data;
it = (struct InternerObject *)t;
hash = max(1, KnuthMultiplicativeHash32(data, size));
hash = max(1, crc32c(0, data, size));
do {
/* it is written that triangle probe halts iff i<n/2 && popcnt(n)==1 */
i = (hash + step * ((step + 1) >> 1)) & (it->n - 1);

View file

@ -36,7 +36,6 @@
#include "libc/runtime/gc.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/knuthmultiplicativehash.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/madv.h"
#include "libc/sysv/consts/map.h"