| 1 | // NB libc does not define this constant on all platforms, so we hard code it |
| 2 | // like CPython does. |
| 3 | // https://github.com/python/cpython/blob/d8b9011702443bb57579f8834f3effe58e290dfc/Include/pyport.h#L372 |
| 4 | pub const INT_MAX: std::ffi::c_int = 2147483647; |
| 5 | |
| 6 | pub type PY_UINT32_T = u32; |
| 7 | pub type PY_UINT64_T = u64; |
| 8 | |
| 9 | pub type PY_INT32_T = i32; |
| 10 | pub type PY_INT64_T = i64; |
| 11 | |
| 12 | pub type Py_uintptr_t = ::libc::uintptr_t; |
| 13 | pub type Py_intptr_t = ::libc::intptr_t; |
| 14 | pub type Py_ssize_t = ::libc::ssize_t; |
| 15 | |
| 16 | pub type Py_hash_t = Py_ssize_t; |
| 17 | pub type Py_uhash_t = ::libc::size_t; |
| 18 | |
| 19 | pub const PY_SSIZE_T_MIN: Py_ssize_t = Py_ssize_t::MIN; |
| 20 | pub const PY_SSIZE_T_MAX: Py_ssize_t = Py_ssize_t::MAX; |
| 21 | |
| 22 | #[cfg(target_endian = "big")] |
| 23 | pub const PY_BIG_ENDIAN: usize = 1; |
| 24 | #[cfg(target_endian = "big")] |
| 25 | pub const PY_LITTLE_ENDIAN: usize = 0; |
| 26 | |
| 27 | #[cfg(target_endian = "little")] |
| 28 | pub const PY_BIG_ENDIAN: usize = 0; |
| 29 | #[cfg(target_endian = "little")] |
| 30 | pub const PY_LITTLE_ENDIAN: usize = 1; |