[libre-riscv-dev] spike-sv non-default element widths

Luke Kenneth Casson Leighton lkcl at lkcl.net
Thu Oct 18 07:57:19 BST 2018


https://stackoverflow.com/questions/3536153/c-dynamically-growing-array
or better

https://stackoverflow.com/a/46351960

that answer.  it's what i remember that DCE/RPC had (has) support for,
and the IDL compiler generates pretty much exactly those types of
structs (which were not actually put over-the-wire it's important to
add)

struct int_list {
    size_t size;
    int value[];
};

so by having a union of the different byte-widths, the only concern
will be to ensure that the implementation checks the length and does
not over-run the end of the actual register file.

yes i appreciate that really things should not be done this way, it's
why DCE/RPC used a type library, make massively-extensive use of
"offset_of", and "interpreted" the format via the type library as like
"runtime bytecode" which specified what to do when packing/unpacking
the stream into actual structs.

funfunfun :)

l.



More information about the libre-riscv-dev mailing list