Message188118
The problem is to support platforms not providing a intmax_t type.
I don't know if the following C code would be a good "approximation" of the maximum integral value (signed/unsigned).
#ifdef HAVE_INTMAX_T
typedef intmax_t Py_intmax_t;
typedef uintmax_t Py_uintmax_t;
#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
typedef PY_LONG_LONG Py_intmax_t;
typedef unsigned PY_LONG_LONG Py_uintmax_t;
#elif SIZEOF_VOID_P <= SIZEOF_LONG
typedef long Py_intmax_t;
typedef unsigned long Py_uintmax_t;
#elif SIZEOF_VOID_P <= SIZEOF_INT
typedef int Py_intmax_t;
typedef unsigned int Py_uintmax_t;
#else
# error "Python needs a typedef for Py_intmax_t in pyport.h."
#endif /* HAVE_INTMAX_T */
If it is not, conversion from/to other types like off_t, time_t, pid_t or uid_t would loose information.
It is the same question than yours: is there a platform with an integer type wider than a pointer (intptr_t/void*)? |
|
Date |
User |
Action |
Args |
2013-04-29 23:45:26 | vstinner | set | recipients:
+ vstinner, Devin Jeanpierre |
2013-04-29 23:45:26 | vstinner | set | messageid: <1367279126.87.0.0774347098139.issue17870@psf.upfronthosting.co.za> |
2013-04-29 23:45:26 | vstinner | link | issue17870 messages |
2013-04-29 23:45:26 | vstinner | create | |
|