Closed GordonSmith closed 3 months ago
Should the load function take two types? One for the type to load and another for the type of the list:
def load(cx, ptr, t, lt): <-------------------------------------------------- assert(ptr == align_to(ptr, alignment(t))) assert(ptr + size(t) <= len(cx.opts.memory)) match despecialize(t): case Bool() : return convert_int_to_bool(load_int(cx, ptr, 1)) case U8() : return load_int(cx, ptr, 1) case U16() : return load_int(cx, ptr, 2) case U32() : return load_int(cx, ptr, 4) case U64() : return load_int(cx, ptr, 8) case S8() : return load_int(cx, ptr, 1, signed=True) case S16() : return load_int(cx, ptr, 2, signed=True) case S32() : return load_int(cx, ptr, 4, signed=True) case S64() : return load_int(cx, ptr, 8, signed=True) case Float32() : return decode_i32_as_float(load_int(cx, ptr, 4)) case Float64() : return decode_i64_as_float(load_int(cx, ptr, 8)) case Char() : return convert_i32_to_char(cx, load_int(cx, ptr, 4)) case String() : return load_string(cx, ptr) case List(lt) : return load_list(cx, ptr, lt) <--------------------------- case Record(fields) : return load_record(cx, ptr, fields) case Variant(cases) : return load_variant(cx, ptr, cases) case Flags(labels) : return load_flags(cx, ptr, labels) case Own() : return lift_own(cx, load_int(cx.opts, ptr, 4), t) case Borrow() : return lift_borrow(cx, load_int(cx.opts, ptr, 4), t)
Closing - my lack of python...
Should the load function take two types? One for the type to load and another for the type of the list: