py: Implement sys.maxsize, standard way to check platform "bitness".

Implementing it as a static constant is a bit peculiar and require cooperation
from long int implementation.
This commit is contained in:
Paul Sokolovsky
2014-07-03 16:50:11 +03:00
parent 381618269a
commit 4e0eeebdc2
6 changed files with 53 additions and 0 deletions

View File

@@ -50,6 +50,11 @@
#define SUFFIX ""
#endif
#if MICROPY_PY_SYS_MAXSIZE
// Export value for sys.maxsize
const mp_obj_int_t mp_maxsize_obj = {{&mp_type_int}, INT_MAX};
#endif
bool mp_obj_int_is_positive(mp_obj_t self_in) {
if (MP_OBJ_IS_SMALL_INT(self_in)) {
return MP_OBJ_SMALL_INT_VALUE(self_in) >= 0;