def ctype_mem_size(ctype):
    """ returns the memory size for a specific ctype """
    if "int8_t" in ctype:
        return 1
    if "int16_t" in ctype:
        return 2
    if "int32_t" in ctype:
        return 4
    if "float" in ctype:
        return 4
    raise RuntimeError("Memory size of ctype %s is unknown!", ctype)