all: Simplify mp_int_t/mp_uint_t definition.

Assuming proper C99 language support, we can select "the int type as big as
a pointer" (most of the time) or "the 64-bit int type" (nanboxing with
REPR_D), and then define everything else automatically.

This simplifies port configuration files.  And the types can still be
overridden if needed.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
Jeff Epler
2025-10-11 19:12:55 -05:00
committed by Damien George
parent eac81de4e0
commit 007f127a61
40 changed files with 106 additions and 188 deletions

View File

@@ -12,8 +12,6 @@
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-giga-r1-wifi"
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
typedef int mp_int_t; // must be pointer size
typedef unsigned int mp_uint_t; // must be pointer size
#define MICROPY_FATFS_EXFAT (1)
#define MICROPY_HW_ENABLE_RTC (1)

View File

@@ -12,8 +12,6 @@
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-nicla-vision"
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
typedef int mp_int_t; // must be pointer size
typedef unsigned int mp_uint_t; // must be pointer size
#define MICROPY_FATFS_EXFAT (1)
#define MICROPY_HW_ENABLE_RTC (1)

View File

@@ -12,8 +12,6 @@
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-opta"
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
typedef int mp_int_t; // must be pointer size
typedef unsigned int mp_uint_t; // must be pointer size
#define MICROPY_FATFS_EXFAT (1)
#define MICROPY_HW_ENABLE_RTC (1)

View File

@@ -12,8 +12,6 @@
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-portenta-h7"
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
typedef int mp_int_t; // must be pointer size
typedef unsigned int mp_uint_t; // must be pointer size
#define MICROPY_FATFS_EXFAT (1)
#define MICROPY_HW_ENABLE_RTC (1)

View File

@@ -5,8 +5,6 @@
#define MICROPY_ALLOC_GC_STACK_SIZE (128)
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
typedef int mp_int_t; // must be pointer size
typedef unsigned int mp_uint_t; // must be pointer size
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
#define MICROPY_HW_HAS_SWITCH (0)

View File

@@ -229,12 +229,6 @@ extern const struct _mp_obj_type_t network_lan_type;
#define MP_SSIZE_MAX (0x7fffffff)
// Assume that if we already defined the obj repr then we also defined these items
#ifndef MICROPY_OBJ_REPR
typedef int mp_int_t; // must be pointer size
typedef unsigned int mp_uint_t; // must be pointer size
#endif
typedef long mp_off_t;
#if MICROPY_PY_THREAD

View File

@@ -33,13 +33,5 @@
#define MICROPY_EMIT_THUMB (0)
#define MICROPY_EMIT_INLINE_THUMB (0)
// Types needed for nan-boxing
#define UINT_FMT "%llu"
#define INT_FMT "%lld"
#define HEX_FMT "%llx"
#define SIZE_FMT "%lu"
typedef int64_t mp_int_t;
typedef uint64_t mp_uint_t;
// Include base configuration file for rest of configuration
#include <mpconfigport.h>