mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 13:00:17 +00:00
...
This commit is contained in:
parent
8d41987eb8
commit
1634defbb2
@ -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)) {
|
||||
|
@ -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; \
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
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)
|
Loading…
x
Reference in New Issue
Block a user