summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-26 17:40:52 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-26 17:40:52 +0000
commit510477557d1cd13dc3cfdebf32338aa1b75180cb (patch)
tree3ea84ff43ecf5780cd357c1cd45bb3c51594d21f /py
parent98fb8935bc54085989cb271eb1a75fe2a6214c43 (diff)
downloadmicropython-510477557d1cd13dc3cfdebf32338aa1b75180cb.tar.gz
micropython-510477557d1cd13dc3cfdebf32338aa1b75180cb.zip
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.
Diffstat (limited to 'py')
-rw-r--r--py/map.h8
-rw-r--r--py/misc.h6
-rw-r--r--py/mpz.h6
-rw-r--r--py/obj.h8
-rw-r--r--py/objarray.c10
-rw-r--r--py/objfun.c10
-rw-r--r--py/runtime.c12
7 files changed, 22 insertions, 38 deletions
diff --git a/py/map.h b/py/map.h
index ce5505571c..afebfda6ec 100644
--- a/py/map.h
+++ b/py/map.h
@@ -4,11 +4,9 @@ typedef struct _mp_map_elem_t {
} 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 278d59d4fa..3671f42d87 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -66,10 +66,8 @@ typedef struct _vstr_t {
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 4a0eba1c12..13a96fd797 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -3,10 +3,8 @@ typedef uint32_t mpz_dbl_dig_t;
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 c21c859596..b664b09443 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -54,7 +54,7 @@ typedef struct _mp_obj_base_t mp_obj_base_t;
#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 @@ mp_obj_t mp_obj_new_bytearray_by_ref(uint n, void *items);
// 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 9e36196e5b..30a2183115 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 7c89c47000..6cdc97cc6d 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -143,12 +143,10 @@ mp_obj_t rt_make_function_var_between(int n_args_min, int n_args_max, mp_fun_var
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 20bfa0b20f..b9caf04570 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -45,14 +45,10 @@ typedef enum {
} 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;