all: Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD.
The "word" referred to by BYTES_PER_WORD is actually the size of mp_obj_t which is not always the same as the size of a pointer on the target architecture. So rename this config value to better reflect what it measures, and also prefix it with MP_. For uses of BYTES_PER_WORD in setting the stack limit this has been changed to sizeof(void *), because the stack usually grows with machine-word sized values (eg an nlr_buf_t has many machine words in it). Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -321,7 +321,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p
|
||||
double f;
|
||||
} fp_dp;
|
||||
fp_dp.f = mp_obj_get_float_to_d(val_in);
|
||||
if (BYTES_PER_WORD == 8) {
|
||||
if (MP_BYTES_PER_OBJ_WORD == 8) {
|
||||
val = fp_dp.i64;
|
||||
} else {
|
||||
int be = struct_type == '>';
|
||||
@@ -342,7 +342,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p
|
||||
|
||||
val = mp_obj_get_int(val_in);
|
||||
// zero/sign extend if needed
|
||||
if (BYTES_PER_WORD < 8 && size > sizeof(val)) {
|
||||
if (MP_BYTES_PER_OBJ_WORD < 8 && size > sizeof(val)) {
|
||||
int c = (mp_int_t)val < 0 ? 0xff : 0x00;
|
||||
memset(p, c, size);
|
||||
if (struct_type == '>') {
|
||||
|
||||
Reference in New Issue
Block a user