all: Move BYTES_PER_WORD definition from ports to py/mpconfig.h

It can still be overwritten by a port in mpconfigport.h but for almost
all cases one can use the provided default.
This commit is contained in:
Damien George 2017-04-01 11:39:38 +11:00
parent 64d00511e1
commit 4c307bfba1
16 changed files with 5 additions and 28 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -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 <sys/types.h>, as it may lead to symbol name clashes
#if _FILE_OFFSET_BITS == 64 && !defined(__LP64__)
typedef long long mp_off_t;

View File

@ -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

View File

@ -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 <sys/types.h>, as it may lead to symbol name clashes
#if _FILE_OFFSET_BITS == 64 && !defined(__LP64__)
typedef long long mp_off_t;

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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"

View File

@ -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 <sys/types.h>, as it may lead to symbol name clashes
#if _FILE_OFFSET_BITS == 64 && !defined(__LP64__)
typedef long long mp_off_t;

View File

@ -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 <sys/types.h>, as it may lead to symbol name clashes
#if _FILE_OFFSET_BITS == 64 && !defined(__LP64__)
typedef long long mp_off_t;

View File

@ -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)

View File

@ -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 \

View File

@ -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 \