summaryrefslogtreecommitdiff
path: root/instance_table.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-07-10 15:53:56 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-07-10 15:54:00 -0400
commitec25b66e85765bafe7a944d805669c931026a5be (patch)
tree5c15ed5f09140ea3006d354bacc092c73771cde7 /instance_table.c
parent7196bd82bbeae548db7c4eb548023d79d169539f (diff)
made types 16 bytes
Diffstat (limited to 'instance_table.c')
-rw-r--r--instance_table.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/instance_table.c b/instance_table.c
index 870ff60..0f1004e 100644
--- a/instance_table.c
+++ b/instance_table.c
@@ -97,7 +97,7 @@ static U64 type_hash(Type *t) {
hash = hash * type_hash(sub) + 0x16225b0aa9993299;
return hash;
case TYPE_FN:
- arr_foreach(t->fn.types, Type, sub)
+ arr_foreach(t->fn->types, Type, sub)
hash = hash * type_hash(sub) + 0x2092d851ab2008de;
return hash;
case TYPE_PTR:
@@ -110,8 +110,8 @@ static U64 type_hash(Type *t) {
hash += (U64)t->struc;
return hash;
case TYPE_ARR:
- hash += type_hash(t->arr.of) * 0x3b6256104800a414 + 0xa901e68bbd8968a1
- + 0xbf79c81a3e68e504 * t->arr.n;
+ hash += type_hash(t->arr->of) * 0x3b6256104800a414 + 0xa901e68bbd8968a1
+ + 0xbf79c81a3e68e504 * t->arr->n;
return hash;
case TYPE_EXPR: break;
}
@@ -169,9 +169,9 @@ static U64 val_ptr_hash(void *v, Type *t) {
case TYPE_ARR: {
U32 x = 1;
U64 hash = 0;
- U64 size = (U64)compiler_sizeof(t->arr.of);
- for (U64 i = 0; i < (U64)t->arr.n; ++i) {
- hash += (U64)x * val_ptr_hash((char *)v + i * size, t->arr.of);
+ U64 size = (U64)compiler_sizeof(t->arr->of);
+ for (U64 i = 0; i < (U64)t->arr->n; ++i) {
+ hash += (U64)x * val_ptr_hash((char *)v + i * size, t->arr->of);
x = rand_u32(x);
}
return hash;
@@ -259,10 +259,10 @@ static bool val_ptr_eq(void *u, void *v, Type *t) {
return true;
}
case TYPE_ARR: {
- U64 size = (U64)compiler_sizeof(t->arr.of);
+ U64 size = (U64)compiler_sizeof(t->arr->of);
char *uptr = u, *vptr = v;
- for (U64 i = 0; i < t->arr.n; ++i) {
- if (!val_ptr_eq(uptr, vptr, t->arr.of))
+ for (U64 i = 0; i < t->arr->n; ++i) {
+ if (!val_ptr_eq(uptr, vptr, t->arr->of))
return false;
uptr += size;
vptr += size;
@@ -270,7 +270,7 @@ static bool val_ptr_eq(void *u, void *v, Type *t) {
return true;
}
case TYPE_SLICE: {
- U64 size = (U64)compiler_sizeof(t->arr.of);
+ U64 size = (U64)compiler_sizeof(t->arr->of);
Slice *r = u;
Slice *s = v;
if (r->len != s->len) return false;