diff --git a/src/modules/dis.c b/src/modules/dis.c index 18fbcd81..c0914716 100644 --- a/src/modules/dis.c +++ b/src/modules/dis.c @@ -57,6 +57,7 @@ static bool disassemble(CodeObject* co) { c11_sbuf__write_int(&ss, byte.arg); switch(byte.op) { + // TODO: see `dis.py` there is a memory issue case OP_LOAD_CONST: { py_Ref value = c11__at(py_TValue, &co->consts, byte.arg); if(py_repr(value)) { diff --git a/src/modules/linalg.c b/src/modules/linalg.c index 63d36d5a..d582e158 100644 --- a/src/modules/linalg.c +++ b/src/modules/linalg.c @@ -305,7 +305,7 @@ DEF_VECTOR_OPS(3) c11_vec##D##i v = py_tovec##D##i(argv); \ uint64_t hash = 0; \ for(int i = 0; i < D; i++) \ - hash = hash * 131071 + (uint32_t)v.data[i] * C; \ + hash = hash * 31 + (uint32_t)v.data[i] * C; \ py_newint(py_retval(), (py_i64)hash); \ return true; \ } diff --git a/src/public/py_dict.c b/src/public/py_dict.c index 1a64600a..fe0c1bce 100644 --- a/src/public/py_dict.c +++ b/src/public/py_dict.c @@ -158,7 +158,7 @@ static bool Dict__set(Dict* self, py_TValue* key, py_TValue* val) { if(res == -1) return false; // error } // no empty slot found - if(self->capacity >= self->entries.length * 8) { + if(self->capacity >= self->entries.length * 10) { return RuntimeError("dict has too much collision: %d/%d", self->entries.length, self->capacity); } Dict__rehash_2x(self); diff --git a/tests/80_linalg.py b/tests/80_linalg.py index cb9da505..3c38a47e 100644 --- a/tests/80_linalg.py +++ b/tests/80_linalg.py @@ -409,8 +409,7 @@ x, y, z = vec3(1.0, 2.0, 3.0) assert x == 1.0 and y == 2.0 and z == 3.0 -d = {} -e = {} -for i in range(10000): - d[vec2i(i, 0)] = i - e[vec3i(i, 0, 0)] = i \ No newline at end of file +d = {vec2i(12, 12): 1035.313708305359, vec2i(12, 11): 2059.313708305359, vec2i(12, 13): 2059.313708305359, vec2i(11, 12): 2059.313708305359, vec2i(13, 12): 2059.313708305359, vec2i(13, 11): 3083.313708305359, vec2i(13, 13): 3083.313708305359, vec2i(14, 12): 3083.313708305359, vec2i(12, 14): 3083.313708305359, vec2i(11, 13): 3083.313708305359, vec2i(12, 10): 3083.313708305359, vec2i(11, 11): 3083.313708305359, vec2i(10, 12): 3083.313708305359, vec2i(13, 14): 4107.313708305359, vec2i(14, 13): 4107.313708305359, vec2i(14, 11): 4107.313708305359, vec2i(15, 12): 4107.313708305359, vec2i(12, 15): 4107.313708305359, vec2i(11, 14): 4107.313708305359, vec2i(13, 10): 4107.313708305359, vec2i(10, 13): 4107.313708305359, vec2i(11, 10): 4107.313708305359, vec2i(10, 11): 4107.313708305359, vec2i(12, 9): 4107.313708305359, vec2i(9, 12): 4107.313708305359, vec2i(14, 14): 5131.313708305359, vec2i(15, 13): 5131.313708305359, vec2i(13, 15): 5131.313708305359, vec2i(15, 11): 5131.313708305359, vec2i(16, 12): 5131.313708305359, vec2i(12, 16): 5131.313708305359, vec2i(11, 15): 5131.313708305359, vec2i(14, 10): 5131.313708305359, vec2i(10, 14): 5131.313708305359, vec2i(13, 9): 5131.313708305359, vec2i(9, 13): 5131.313708305359} +d[vec2i(11, 9)] = 1 + +print(d) \ No newline at end of file