mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 02:38:31 +00:00
Hunt down some small bugs
This commit is contained in:
parent
95b142e4e5
commit
830334d767
15 changed files with 1156 additions and 83 deletions
|
@ -23,10 +23,18 @@
|
|||
#include "libc/macros.h"
|
||||
#include "libc/nt/accounting.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/knuthmultiplicativehash.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/auxv.h"
|
||||
|
||||
static uint32_t KnuthMultiplicativeHash32(const void *buf, size_t size) {
|
||||
size_t i;
|
||||
uint32_t h;
|
||||
const uint32_t kPhiPrime = 0x9e3779b1;
|
||||
const unsigned char *p = (const unsigned char *)buf;
|
||||
for (h = i = 0; i < size; i++) h = (p[i] + h) * kPhiPrime;
|
||||
return h;
|
||||
}
|
||||
|
||||
static textwindows noinline uint32_t GetUserNameHash(void) {
|
||||
char16_t buf[257];
|
||||
uint32_t size = ARRAYLEN(buf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue