diff options
author | Damien George <damien.p.george@gmail.com> | 2014-09-06 18:39:39 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-09-06 18:39:39 +0100 |
commit | 33b50a02176bcf4f7114498f9925003808d6e53f (patch) | |
tree | 8429efb0fddd5b567a1fc6fbcde421a24471282c /py | |
parent | c7a79284bb13671d8829c68f28c6839fa0b76054 (diff) | |
parent | 78fde4819c2e56365947dcfcc686d447c1d75f09 (diff) | |
download | micropython-33b50a02176bcf4f7114498f9925003808d6e53f.tar.gz micropython-33b50a02176bcf4f7114498f9925003808d6e53f.zip |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py')
-rw-r--r-- | py/binary.c | 2 | ||||
-rw-r--r-- | py/mpconfig.h | 4 | ||||
-rw-r--r-- | py/objint_longlong.c | 2 | ||||
-rw-r--r-- | py/objint_mpz.c | 16 |
4 files changed, 15 insertions, 9 deletions
diff --git a/py/binary.c b/py/binary.c index 783a48efdc..919ba87846 100644 --- a/py/binary.c +++ b/py/binary.c @@ -58,6 +58,8 @@ int mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign) { size = 4; break; case 'q': case 'Q': size = 8; break; + case 'P': case 'O': case 'S': + size = sizeof(void*); break; } break; case '@': { diff --git a/py/mpconfig.h b/py/mpconfig.h index 78c288d7c3..633a4a52dd 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -448,6 +448,10 @@ typedef double mp_float_t; #define MP_PLAT_FREE_EXEC(ptr, size) m_del(byte, ptr, size) #endif +#ifndef MP_SSIZE_MAX +#define MP_SSIZE_MAX SSIZE_MAX +#endif + // printf format spec to use for mp_int_t and friends #ifndef INT_FMT #ifdef __LP64__ diff --git a/py/objint_longlong.c b/py/objint_longlong.c index c4c16139fd..43bdcabdce 100644 --- a/py/objint_longlong.c +++ b/py/objint_longlong.c @@ -52,7 +52,7 @@ #if MICROPY_PY_SYS_MAXSIZE // Export value for sys.maxsize -const mp_obj_int_t mp_maxsize_obj = {{&mp_type_int}, INT_MAX}; +const mp_obj_int_t mp_maxsize_obj = {{&mp_type_int}, MP_SSIZE_MAX}; #endif mp_int_t mp_obj_int_hash(mp_obj_t self_in) { diff --git a/py/objint_mpz.c b/py/objint_mpz.c index 20fba00bf7..440b4f3187 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -47,14 +47,14 @@ // Export value for sys.maxsize #define DIG_MASK ((1L << MPZ_DIG_SIZE) - 1) STATIC const mpz_dig_t maxsize_dig[MPZ_NUM_DIG_FOR_INT] = { - (INT_MAX >> MPZ_DIG_SIZE * 0) & DIG_MASK, - #if (INT_MAX >> MPZ_DIG_SIZE * 0) > DIG_MASK - (INT_MAX >> MPZ_DIG_SIZE * 1) & DIG_MASK, - #if (INT_MAX >> MPZ_DIG_SIZE * 1) > DIG_MASK - (INT_MAX >> MPZ_DIG_SIZE * 2) & DIG_MASK, - (INT_MAX >> MPZ_DIG_SIZE * 3) & DIG_MASK, - (INT_MAX >> MPZ_DIG_SIZE * 4) & DIG_MASK, -// (INT_MAX >> MPZ_DIG_SIZE * 5) & DIG_MASK, + (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 0) & DIG_MASK, + #if (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 0) > DIG_MASK + (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 1) & DIG_MASK, + #if (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 1) > DIG_MASK + (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 2) & DIG_MASK, + (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 3) & DIG_MASK, + (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 4) & DIG_MASK, +// (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 5) & DIG_MASK, #endif #endif }; |