diff --git a/bare-arm/mpconfigport.h b/bare-arm/mpconfigport.h index 912fae66fc..97e866bdb7 100644 --- a/bare-arm/mpconfigport.h +++ b/bare-arm/mpconfigport.h @@ -46,8 +46,6 @@ // type definitions for the specific machine -#define BYTES_PER_WORD (4) - #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1)) #define UINT_FMT "%lu" diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h index a8dc0cfeb8..4d19900aee 100644 --- a/cc3200/mpconfigport.h +++ b/cc3200/mpconfigport.h @@ -200,7 +200,6 @@ extern const struct _mp_obj_module_t mp_module_ussl; // type definitions for the specific machine -#define BYTES_PER_WORD (4) #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1)) #define MP_SSIZE_MAX (0x7FFFFFFF) diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h index 07bd48f679..d40eaba91b 100644 --- a/esp8266/mpconfigport.h +++ b/esp8266/mpconfigport.h @@ -118,8 +118,6 @@ // type definitions for the specific machine -#define BYTES_PER_WORD (4) - #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p))) #define MP_SSIZE_MAX (0x7fffffff) diff --git a/examples/embedding/mpconfigport_minimal.h b/examples/embedding/mpconfigport_minimal.h index 48d2008583..d16827fa32 100644 --- a/examples/embedding/mpconfigport_minimal.h +++ b/examples/embedding/mpconfigport_minimal.h @@ -119,8 +119,6 @@ typedef int mp_int_t; // must be pointer size typedef unsigned int mp_uint_t; // must be pointer size #endif -#define BYTES_PER_WORD sizeof(mp_int_t) - // Cannot include , as it may lead to symbol name clashes #if _FILE_OFFSET_BITS == 64 && !defined(__LP64__) typedef long long mp_off_t; diff --git a/minimal/mpconfigport.h b/minimal/mpconfigport.h index e08943860b..47fc984290 100644 --- a/minimal/mpconfigport.h +++ b/minimal/mpconfigport.h @@ -57,8 +57,6 @@ // type definitions for the specific machine -#define BYTES_PER_WORD (4) - #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1)) // This port is intended to be 32-bit, but unfortunately, int32_t for diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index 0f76510986..383de14399 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -100,8 +100,6 @@ typedef int mp_int_t; // must be pointer size typedef unsigned int mp_uint_t; // must be pointer size #endif -#define BYTES_PER_WORD sizeof(mp_int_t) - // Cannot include , as it may lead to symbol name clashes #if _FILE_OFFSET_BITS == 64 && !defined(__LP64__) typedef long long mp_off_t; diff --git a/pic16bit/mpconfigport.h b/pic16bit/mpconfigport.h index a0371a8ae3..e4113956b3 100644 --- a/pic16bit/mpconfigport.h +++ b/pic16bit/mpconfigport.h @@ -68,7 +68,6 @@ // type definitions for the specific machine #define MP_ENDIANNESS_LITTLE (1) -#define BYTES_PER_WORD (2) #define MPZ_DIG_SIZE (8) // The xc16 compiler doesn't seem to respect alignment (!!) so we diff --git a/py/mpconfig.h b/py/mpconfig.h index 54cf0f3d3d..9c89fc18aa 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1105,6 +1105,11 @@ typedef double mp_float_t; #define STATIC static #endif +// Number of bytes in a word +#ifndef BYTES_PER_WORD +#define BYTES_PER_WORD (sizeof(mp_uint_t)) +#endif + #define BITS_PER_BYTE (8) #define BITS_PER_WORD (BITS_PER_BYTE * BYTES_PER_WORD) // mp_int_t value with most significant bit set diff --git a/qemu-arm/mpconfigport.h b/qemu-arm/mpconfigport.h index f642c64287..974d3520b3 100644 --- a/qemu-arm/mpconfigport.h +++ b/qemu-arm/mpconfigport.h @@ -39,8 +39,6 @@ // type definitions for the specific machine -#define BYTES_PER_WORD (4) - #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1)) #define MP_SSIZE_MAX (0x7fffffff) diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index 339360baef..3f36831997 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -264,8 +264,6 @@ extern const struct _mp_obj_module_t mp_module_network; // type definitions for the specific machine -#define BYTES_PER_WORD (4) - #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1)) #define MP_SSIZE_MAX (0x7fffffff) diff --git a/teensy/mpconfigport.h b/teensy/mpconfigport.h index 07f60c43f6..8c40220465 100644 --- a/teensy/mpconfigport.h +++ b/teensy/mpconfigport.h @@ -54,8 +54,6 @@ extern const struct _mp_obj_module_t time_module; // type definitions for the specific machine -#define BYTES_PER_WORD (4) - #define UINT_FMT "%u" #define INT_FMT "%d" diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index a858845945..7ecfc28c09 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -233,8 +233,6 @@ typedef unsigned int mp_uint_t; // must be pointer size #endif #endif -#define BYTES_PER_WORD sizeof(mp_int_t) - // Cannot include , as it may lead to symbol name clashes #if _FILE_OFFSET_BITS == 64 && !defined(__LP64__) typedef long long mp_off_t; diff --git a/unix/mpconfigport_minimal.h b/unix/mpconfigport_minimal.h index 65e35c8d99..788c8519d2 100644 --- a/unix/mpconfigport_minimal.h +++ b/unix/mpconfigport_minimal.h @@ -127,8 +127,6 @@ typedef int mp_int_t; // must be pointer size typedef unsigned int mp_uint_t; // must be pointer size #endif -#define BYTES_PER_WORD sizeof(mp_int_t) - // Cannot include , as it may lead to symbol name clashes #if _FILE_OFFSET_BITS == 64 && !defined(__LP64__) typedef long long mp_off_t; diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h index 6156ad39ef..844e2618f4 100644 --- a/windows/mpconfigport.h +++ b/windows/mpconfigport.h @@ -128,8 +128,6 @@ typedef int mp_int_t; // must be pointer size typedef unsigned int mp_uint_t; // must be pointer size #endif -#define BYTES_PER_WORD sizeof(mp_int_t) - // Just assume Windows is little-endian - mingw32 gcc doesn't // define standard endianness macros. #define MP_ENDIANNESS_LITTLE (1) diff --git a/zephyr/mpconfigport.h b/zephyr/mpconfigport.h index e0586dcfc1..0949d1374d 100644 --- a/zephyr/mpconfigport.h +++ b/zephyr/mpconfigport.h @@ -99,8 +99,6 @@ typedef void *machine_ptr_t; // must be of pointer size typedef const void *machine_const_ptr_t; // must be of pointer size typedef long mp_off_t; -#define BYTES_PER_WORD (sizeof(mp_int_t)) - #define MP_STATE_PORT MP_STATE_VM #define MICROPY_PORT_ROOT_POINTERS \ diff --git a/zephyr/mpconfigport_minimal.h b/zephyr/mpconfigport_minimal.h index 04383f6e32..772335c0a1 100644 --- a/zephyr/mpconfigport_minimal.h +++ b/zephyr/mpconfigport_minimal.h @@ -85,8 +85,6 @@ typedef void *machine_ptr_t; // must be of pointer size typedef const void *machine_const_ptr_t; // must be of pointer size typedef long mp_off_t; -#define BYTES_PER_WORD (sizeof(mp_int_t)) - #define MP_STATE_PORT MP_STATE_VM #define MICROPY_PORT_ROOT_POINTERS \