-
Notifications
You must be signed in to change notification settings - Fork 971
Expand file tree
/
Copy pathcomplexobject.rs
More file actions
30 lines (25 loc) · 973 Bytes
/
complexobject.rs
File metadata and controls
30 lines (25 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::object::*;
use core::ffi::{c_double, c_int};
use core::ptr::addr_of_mut;
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
#[cfg_attr(PyPy, link_name = "PyPyComplex_Type")]
pub static mut PyComplex_Type: PyTypeObject;
}
#[inline]
pub unsafe fn PyComplex_Check(op: *mut PyObject) -> c_int {
PyObject_TypeCheck(op, addr_of_mut!(PyComplex_Type))
}
#[inline]
pub unsafe fn PyComplex_CheckExact(op: *mut PyObject) -> c_int {
Py_IS_TYPE(op, addr_of_mut!(PyComplex_Type))
}
extern "C" {
// skipped non-limited PyComplex_FromCComplex
#[cfg_attr(PyPy, link_name = "PyPyComplex_FromDoubles")]
pub fn PyComplex_FromDoubles(real: c_double, imag: c_double) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyComplex_RealAsDouble")]
pub fn PyComplex_RealAsDouble(op: *mut PyObject) -> c_double;
#[cfg_attr(PyPy, link_name = "PyPyComplex_ImagAsDouble")]
pub fn PyComplex_ImagAsDouble(op: *mut PyObject) -> c_double;
}