py: Take out bitfield entries from their own structure.
Don't need to wrap bitfields in their own struct. Compiler does the
correct thing without it.
diff --git a/py/map.h b/py/map.h
index ce55055..afebfda 100644
--- a/py/map.h
+++ b/py/map.h
@@ -4,11 +4,9 @@
} mp_map_elem_t;
typedef struct _mp_map_t {
- struct {
- machine_uint_t all_keys_are_qstrs : 1;
- machine_uint_t table_is_fixed_array : 1;
- machine_uint_t used : (8 * sizeof(machine_uint_t) - 2);
- };
+ machine_uint_t all_keys_are_qstrs : 1;
+ machine_uint_t table_is_fixed_array : 1;
+ machine_uint_t used : (8 * sizeof(machine_uint_t) - 2);
machine_uint_t alloc;
mp_map_elem_t *table;
} mp_map_t;
diff --git a/py/misc.h b/py/misc.h
index 278d59d..3671f42 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -66,10 +66,8 @@
int alloc;
int len;
char *buf;
- struct {
- bool had_error : 1;
- bool fixed_buf : 1;
- };
+ bool had_error : 1;
+ bool fixed_buf : 1;
} vstr_t;
// convenience macro to declare a vstr with a fixed size buffer on the stack
diff --git a/py/mpz.h b/py/mpz.h
index 4a0eba1..13a96fd 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -3,10 +3,8 @@
typedef int32_t mpz_dbl_dig_signed_t;
typedef struct _mpz_t {
- struct {
- machine_uint_t neg : 1;
- machine_uint_t alloc : 31;
- };
+ machine_uint_t neg : 1;
+ machine_uint_t alloc : 31;
machine_uint_t len;
mpz_dig_t *dig;
} mpz_t;
diff --git a/py/obj.h b/py/obj.h
index c21c859..b664b09 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -54,7 +54,7 @@
#define MP_DECLARE_CONST_FUN_OBJ(obj_name) extern const mp_obj_fun_native_t obj_name
-#define MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, is_kw, n_args_min, n_args_max, fun_name) const mp_obj_fun_native_t obj_name = {{&fun_native_type}, {is_kw, n_args_min}, n_args_max, (void *)fun_name}
+#define MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, is_kw, n_args_min, n_args_max, fun_name) const mp_obj_fun_native_t obj_name = {{&fun_native_type}, is_kw, n_args_min, n_args_max, (void *)fun_name}
#define MP_DEFINE_CONST_FUN_OBJ_0(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 0, 0, (mp_fun_0_t)fun_name)
#define MP_DEFINE_CONST_FUN_OBJ_1(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 1, 1, (mp_fun_1_t)fun_name)
#define MP_DEFINE_CONST_FUN_OBJ_2(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 2, 2, (mp_fun_2_t)fun_name)
@@ -374,10 +374,8 @@
// functions
typedef struct _mp_obj_fun_native_t { // need this so we can define const objects (to go in ROM)
mp_obj_base_t base;
- struct {
- bool is_kw : 1;
- machine_uint_t n_args_min : (8 * sizeof(machine_uint_t) - 1); // inclusive
- };
+ bool is_kw : 1;
+ machine_uint_t n_args_min : (8 * sizeof(machine_uint_t) - 1); // inclusive
machine_uint_t n_args_max; // inclusive
void *fun;
// TODO add mp_map_t *globals
diff --git a/py/objarray.c b/py/objarray.c
index 9e36196..30a2183 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -16,12 +16,10 @@
typedef struct _mp_obj_array_t {
mp_obj_base_t base;
- struct {
- machine_uint_t typecode : 8;
- // free is number of unused elements after len used elements
- // alloc size = len + free
- machine_uint_t free : (8 * sizeof(machine_uint_t) - 8);
- };
+ machine_uint_t typecode : 8;
+ // free is number of unused elements after len used elements
+ // alloc size = len + free
+ machine_uint_t free : (8 * sizeof(machine_uint_t) - 8);
machine_uint_t len; // in elements
void *items;
} mp_obj_array_t;
diff --git a/py/objfun.c b/py/objfun.c
index 7c89c47..6cdc97c 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -143,12 +143,10 @@
typedef struct _mp_obj_fun_bc_t {
mp_obj_base_t base;
mp_map_t *globals; // the context within which this function was defined
- struct {
- machine_uint_t n_args : 15; // number of arguments this function takes
- machine_uint_t n_def_args : 15; // number of default arguments
- machine_uint_t takes_var_args : 1; // set if this function takes variable args
- machine_uint_t takes_kw_args : 1; // set if this function takes keyword args
- };
+ machine_uint_t n_args : 15; // number of arguments this function takes
+ machine_uint_t n_def_args : 15; // number of default arguments
+ machine_uint_t takes_var_args : 1; // set if this function takes variable args
+ machine_uint_t takes_kw_args : 1; // set if this function takes keyword args
uint n_state; // total state size for the executing function (incl args, locals, stack)
const byte *bytecode; // bytecode for the function
qstr *args; // argument names (needed to resolve positional args passed as keywords)
diff --git a/py/runtime.c b/py/runtime.c
index 20bfa0b..b9caf04 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -45,14 +45,10 @@
} mp_code_kind_t;
typedef struct _mp_code_t {
- struct {
- mp_code_kind_t kind : 8;
- uint scope_flags : 8;
- };
- struct {
- uint n_args : 16;
- uint n_state : 16;
- };
+ mp_code_kind_t kind : 8;
+ uint scope_flags : 8;
+ uint n_args : 16;
+ uint n_state : 16;
union {
struct {
byte *code;