Browse Source

remove prints

master
Martin Dørum 3 years ago
parent
commit
78d7dd552c
1 changed files with 0 additions and 6 deletions
  1. 0
    6
      src/vm/namespace.c

+ 0
- 6
src/vm/namespace.c View File

#include "vm/vm.h" #include "vm/vm.h"


#include <stdio.h>

static const l2_word tombstone = ~(l2_word)0; static const l2_word tombstone = ~(l2_word)0;


static struct l2_vm_namespace *set(struct l2_vm_namespace *ns, l2_word key, l2_word val); static struct l2_vm_namespace *set(struct l2_vm_namespace *ns, l2_word key, l2_word val);


static struct l2_vm_namespace *alloc(size_t size, l2_word mask) { static struct l2_vm_namespace *alloc(size_t size, l2_word mask) {
printf("alloc, size %zu, mask allows up to [%u]\n", size, mask);
struct l2_vm_namespace *ns = calloc( struct l2_vm_namespace *ns = calloc(
1, sizeof(struct l2_vm_namespace) + sizeof(l2_word) * size * 2); 1, sizeof(struct l2_vm_namespace) + sizeof(l2_word) * size * 2);
ns->size = size; ns->size = size;
static struct l2_vm_namespace *set(struct l2_vm_namespace *ns, l2_word key, l2_word val) { static struct l2_vm_namespace *set(struct l2_vm_namespace *ns, l2_word key, l2_word val) {
if (ns == NULL) { if (ns == NULL) {
ns = alloc(16, 0x0f); ns = alloc(16, 0x0f);
printf("alloc to %zu\n", ns->size);
} else if (ns->len >= ns->size / 2) { } else if (ns->len >= ns->size / 2) {
ns = grow(ns); ns = grow(ns);
printf("grew to %zu\n", ns->size);
} }


for (l2_word i = 0; ; ++i) { for (l2_word i = 0; ; ++i) {
if (k == 0) { if (k == 0) {
return 0; return 0;
} else if (k == key) { } else if (k == key) {
printf("found, %i collisions\n", i);
return ns->data[ns->size + hash]; return ns->data[ns->size + hash];
} }
} }

Loading…
Cancel
Save