1
0
Fork 0

07: C: Faster number conversion

This commit is contained in:
Mia Herkt 2022-12-07 23:51:57 +01:00
parent 5cb23bf245
commit 824fe43fe6
Signed by: mia
GPG Key ID: 72E154B8622EC191
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <ctype.h>
uint32_t fnv1a_32(const char *buf, size_t len)
{
@ -80,7 +81,8 @@ int main(int argc, char **argv) {
} else if (l[0] == 'd') {
addent(current, l + 4);
} else {
size_t sz = strtoul(l, NULL, 10);
size_t sz = 0;
while (isdigit(*l)) sz = 10 * sz + (*l++ - '0');
entry *f = current;
for (; f->parent; f = f->parent)
f->size += sz;